Reputation: 33
I'm trying to use filtering and sorting with Angularjs, but my filter only fires once. I have looked at alot of other samples but it is not clear to me why this only fires once.
HTML
Search: <input ng-model="query.$">
From: <input ng-model="query.From">
DepartureTime: <input ng-model="query.DepartureTime">
JS $scope.$watch('query', function (newValue, oldValue) { /* */ }
Upvotes: 0
Views: 151
Reputation: 17492
You need to deep watch query
since you're looking for changes in it's child properties, you do that by passing true as the third argument of $watch
$scope.$watch('query', function (newValue, oldValue) {
//
},true)
Upvotes: 0