javascript - AngularJS Filter After One Time Binding in ng-repeat -


i wondering if possible one-time bind variable in ng-repeat directive , filter on variable.

my code right unfortuantely performs one-time binding of variable after filtering has been performed, though need binding done before filtering performed.

here code:

<div flex="20" ng-repeat="item in ::vm.items | filter: vm.itemsearch      | limitto: vm.query.limit : (vm.query.page -1) * vm.query.limit">    </div>

keep in mind vm.items array potentially 20,000 elements in side, hence need one-time binding.

the filters used both searching , pagination. i'd able following:

<div flex="20" ng-repeat="item in (::vm.items) | filter: vm.itemsearch      | limitto: vm.query.limit : (vm.query.page -1) * vm.query.limit">    </div>

however, not valid angularjs syntax due following error:

syntax error: token ':' not primary expression @ column 2 of expression.

does have way of getting around limitation?

i don't think that's possible. 1 time bound value won't change after applying filtering.

you should pass filtered result ng-repeat. performancewise | limitto trick. should put method inside controller - think error comes : or-operator there.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -