I need to use sublist directive in few places of the page, and it should contain sometimes full fields list, but sometimes filtered. Here is my nai
The $digest iterations error typically happens when there is a watcher that changes the model. In the error case, the isolate fields binding is bound to the result of a filter. That binding creates a watcher. Since the filter returns a new object from a function invocation each time it runs, it causes the watcher to continually trigger, because the old value never matches the new (See this comment from Igor in Google Groups).
A good fix would be to bind fields in both cases like:
And add another optional attribute to the second case for filtering:
Then adjust your directive like:
return {
restrict: 'E',
scope: {
fields: '=',
filterBy: '='
},
template: ''+
'here i am: {{f}}'
};
Note: Remember to close your sublist tags in your fiddle.
Here is a fiddle