in my program iam displaying a list of images. And then iam filtering it with a tag name. So here is my filter.
app.filter('myFilter', function()
{
var filtered = [];
return (function(items, text)
{
if (text === undefined)
{
return items;
}
else
{
angular.forEach(items, function(value, key)
{
var sample = value.tag;
angular.forEach(sample, function(value1, key)
{
if (text === value1)
{
filtered.push(value);
}
});
});
}
return filtered;
})
});
And the html is:
<ul>
<li ng-repeat="x in outputphotos| myFilter:text">
<a href="#displayimage/{{x.imageId}}"><img ng-src="{{x.url}}"></a>
</li>
</ul>
And in the output it will filter one time. But if second time i enter a tag then it wont filter. And shows an error in console 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [] Duplicates in a repeater are not allowed. Repeater: x in outputphotos| myFilter:text key: object:004
I dont know how to change this error.