I went through the AngularJS tutorial and it\'s pretty neat. I\'ve also dipped into Backbone and Ember.js (though not totally familiar with either) but I\'ve heard lots of prais
In a directive, you could $watch for a change on your list of cars and reapply the markers on your map. I am not familiar with Google Maps programming, but here's an attempt to illustrate what I talking about: http://plnkr.co/edit/d8Dn6epgnQ9UvWrMDAk8?p=preview
EDIT:
I found a great way of keeping track of the filtered results:
This create on the fly the variable filteredcars and no need to bind a change event on the input query!
So to recap:
1) You can $watch data for change. But don't forget the 3rd parameter to tell it is an array.
scope.$watch('myvar', function(newval, oldval) {...}, true);
2) You can create a variable on the fly containing the filtered results of an expression coming from an ng-repeat.
3) Don't forget to empty the map element before you append child elements, otherwise, the filtered elements won't appear to be working.
讨论(0)
- 热议问题