javascript - need help understanding ngRepeat with filter -


i'm trying figure out ng-repeat line of code doing,

<div ng-repeat="user in filtered = (main.users | candidate: main.filterby)"> 

i understand line below create div users in main.users

<div ng-repeat="user in main.users"> 

what first example doing? assume theres filter going on doesn't resemble syntax of filter examples see in angular docs

basically above syntax filtering main.users candidate filter passing main.filterby value filter using line (main.users | candidate: main.filterby) , result of getting stored in filtered variable. each time when digest cycle fires see filtered value updated.

official refactored , semantic syntax here

<div ng-repeat="user in main.users | candidate: main.filterby filtered"> 

which says can have filtered result in filtered scope variable used alias of output.

sample plunkr


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -