This article describes the method of removing duplicate data in Angularjs' ng-repeat. Share it for your reference, as follows:
1. JS:
ngApp.filter('unique', function () { return function (collection, keyname) { var output = [], keys = []; angular.forEach(collection, function (item) { var key = item[keyname]; if (keys.indexOf(key) === -1) { keys.push(key); output.push(item); } }); return output; };});2. Html:
<div ng-repeat="item in items | unique: 'id'"></div>
I hope this article will be helpful to everyone's AngularJS programming.