An attempt to use a filter on a directive with isolate scope:
<div tags="p.tags | refTags"></div>
Causes an infinite loop in the $digest cycle:
This error occurs when the application's model becomes unstable and each $digest cycle triggers a state change and subsequent $digest cycle. Angular detects this situation and prevents an infinite loop from causing the browser to become unresponsive.
.directive 'tags', ->
restrict: 'A'
scope:
tags: '='
templateUrl: 'partials/tags.html'
.filter 'refTags', ->
(tags) ->
['a filtered', 'array of values']
partials/tags.html
<ul>
<li ng-repeat="tag in tags">{{tag.tag}}</li>
</ul>
p.tags in the controller
p.tags = ['HTML5', 'CSS', 'JavaScript', 'Angular JS', 'Backbone JS', 'Node JS', 'SASS + Compass', 'Oragami', 'Running', 'Cat Food', '#catfood']
Is this behavior normal?
- Can a filter not be use on a value passing in to the isolate scope of a directive?
- Is there a workaround for this? I need to filter the arrays values
- Is there another solution with a different design?