YousefED / ElasticUI

AngularJS directives for Elasticsearch
http://www.elasticui.com
Other
526 stars 138 forks source link

Problem getting filter to fire #74

Closed remotewhiteboard closed 8 years ago

remotewhiteboard commented 8 years ago

So I have a filter setup

<input ng-checked="latitude != 0" type="checkbox" eui-filter="ejs.GeoDistanceFilter(\'location\').distance(100) .point(ejs.GeoPoint([latitude, longitude]))" ng-model="filter.enabled">

And was hoping it would fire when I set the latitude value. but it does not. I mean, when I set the latitude from a drop down, the input becomes checked, but it does cause the search to fire??

YousefED commented 8 years ago

Do you have some sample code?

remotewhiteboard commented 8 years ago

Sorry, I have now put in the markdown above.

YousefED commented 8 years ago

Probably has to do with a common angular mistake, binding directly to primitives.

see: http://stackoverflow.com/questions/17178943/does-my-ng-model-really-need-to-have-a-dot-to-avoid-child-scope-problems

remotewhiteboard commented 8 years ago

Thanks for getting back to me so quickly.

I tried converting it to a a non primitive

the object:

$scope.loc={latitude:0, longitude:0}

and the filter checkbox

<input ng-checked="loc.latitude != 0" type="checkbox" eui-filter="ejs.GeoDistanceFilter('location').distance(100).point(ejs.GeoPoint([loc.latitude, loc.longitude]))" ng-model="filter.enabled">

Still no luck. So when I click the checkbox, it filters it fine. When I select a lat/lon from the dropdown, and set the object (and I checked, it is being set), it checks the checkbox, but it does not run the filter?

Anyway I can do it manually? Any other ideas?