Ghaniball Ghaniball - 1 year ago 184
AngularJS Question

ngrepeat alias as and controller as

I get this error
when I try to use ngRepeat alias as syntax with controller as syntax:

<li ng-repeat="item in vm.items | filter:vm.searchString as vm.collections">{{item}}</li>

It's not allowed or I do something wrong?

rob rob
Answer Source

if you need to store the result on the vm variable you can do it like this

<li ng-repeat="item in vm.collections = (vm.items | filter:vm.searchString)">{{item}}</li>

If not then Donal's solution will work

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download