-
Notifications
You must be signed in to change notification settings - Fork 89
Filter chaining: does order of filters matter? #74
Comments
Hi Zoechi, It looks like Filter Chaining would definitely matter, depending on where the filter is placed would change behavior. I agree the tutorial glosses over, formatters, not enough detail to know how they work. It is not clear how the filter order is evaluated, however below is my pseudo mapping of I think it works IMHO. I agree it must be from right to left. It would be nice to get a deeper understanding of how this black magic works. Chain of Execution for Evaluating filters in ng-repeatFormatters/Filters gain access to list inside repeaters, such as ng-repeat recipeList is provided via ng-repeat's scope to cf cf=categoryfilter(list, map<category, isChecked>) --> categorizedList fltr=filter (list, nameFilterString)--> filteredList, name ordBy=orderBy(list, name)--> orderdList 1.First get categories selected by user, pass list to next filter <span 4.ng-repeat=recipe in ordererdList | <==3.ordBy(fltr) | <== 2.fltr(cf, nameFilterstring) | <==1.cf(recipeList , map<category, isChecked) /> |
Did not all fit in Comment Above (here is missing text): Html View (from right to left: 1., 2., 3., 4. as indicated below): < 4.ng-repeat=recipe in ordererdList | <==3.ordBy(fltr) | <== 2.fltr(cf, nameFilterstring) | <== 1. cf(recipeList , map < category, isChecked > ) >
< / > |
For complete discussion on this topic view stack overflow reference below: http://stackoverflow.com/questions/25398707/angulardart-filter-chaining-does-order-of-filters-matter |
https://angulardart.org/tutorial/07-ch05-filter-service.html
The example indicates that the filters are evaluated from right to left but it's not stated explicitely. It could also be left to right (would lead to the same result but probably less efficient).
A brief explanation would be helpful.
The text was updated successfully, but these errors were encountered: