javascript - Angularjs: greater than filter with ng-repeat -


i'm applying greater filter ng-repeat tag. wrote following custom filter function:

$scope.pricerangefilter = function (location) {     return location.price >= $scope.minprice; }; 

and use in following html code:

<div ng-repeat="m in map.markers | filter:pricerangefilter"> 

what best way trigger refresh of ng-repeat tag when $scope.minprice updated?

it should automatic. when $scope.minprice changed, repeater automatically updated.

function ctrl($scope,  $timeout) {     $scope.map = [{         name: 'map1',         price: 1     }, {         name: 'map2',         price: 2     }, {         name: 'map3',         price: 3     }];     $scope.minprice = 0;     $scope.pricerangefilter = function (location) {         return location.price >= $scope.minprice;     };      $timeout(function () {         $scope.minprice = 1.5;     }, 2000); } 

demo on jsfiddle


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -