简体   繁体   中英

AngularJS ng-repeat and filter

I'm using scope.$first and scope.$index to apply accordion to my content when ng-repeat finishes populating it. At first I was using just scope.$last but faced this problem - when try to search for some info (using filter) and then turn back to the whole list, accordion doesn't apply.

How to apply accordion when ng-repeat finishes and save it further while filtering?

I suggest wrapping the "apply accordion" functionality into a directive. Define a template for the ng-repeat stuff, then $watch() the model data for changes. When the $watch triggers, apply the accordion stuff.

See also https://groups.google.com/d/topic/angular/lACrEA-TIto/discussion
and http://angular-ui.github.com/bootstrap/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM