Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does `filter` trigger some many times? [duplicate]

Tags:

angularjs

http://plnkr.co/edit/b1yGAwkzojF4BFWgpMsv?p=preview

Why did filter trigger some many times?

I guess {{name|test}} will tigger twice because the name is null at first, then got value at controller.

Why did it trigger filter when include template?

like image 677
atian25 Avatar asked Aug 19 '13 08:08

atian25


1 Answers

Every filter is called at least once every digest cycle. This SO answer has a fiddle that demonstrates this.

When a template is loaded, you are in a digest cycle, so all filters will be called.

like image 52
Mark Rajcok Avatar answered Oct 26 '22 22:10

Mark Rajcok