I am attempting to filter the results of an ng-repeat in a directive template. The below solution works as in it displays well on the screen, however I now get the error: Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
I referenced this page and the solution did not work: https://docs.angularjs.org/error/$rootScope/infdig
Any suggestions on how I can fix this? Or a better way to go about it?
HTML:
<filtered-set items="businesses | filter : {cat: 'jedi'} : true | filter:query |orderBy: orderList"></filtered-set>
Template:
<div class="bscroll mThumbnailScroller" data-mts-axis="x">
<ul>
<li class="business-card" data-ng-repeat="business in items" data-ng-click="select(business)">
<h2>{{business.name}}</h2>
<p>{{business.cat}}</p>
</li>
</ul>
</div>
Angular JS:
.controller('starWarsCtrl', function ($scope) {
$scope.businesses = [
{"name": "Obi-Wan Kenobi",
"index":88,
"cat": "jedi"},
{"name": "Yoda",
"index":69,
"cat":"jedi"},
{"name": "Lando",
"index":31,
"cat": "smuggler"},
{"name": "Han Solo",
"index":90,
"cat": "smuggler"},
{"name": "Darth Vader",
"index":98,
"cat": "sith"},
{"name": "Jar-Jar Binks",
"index":80,
"cat": "alien"},
{"name": "Mace Windu",
"index":45,
"cat": "jedi"},
{"name": "Chewy",
"index":76,
"cat": "smuggler"}
];
.directive('filteredSet', function() {
return {
restrict: 'E',
scope: {
items: '='
},
templateUrl: 'partials/filtered-set.html'
};
});