唯一在 angular.js 中不起作用

Unique not working in angular.js

这是我的代码

<ul>
  <li ng-repeat="x in names | orderBy:'-name' | unique: 'name'">
    {{ ' Name =  ' + (x.name | uppercase) + ' &nbsp; &nbsp; Roll No = ' + x.rollno }}
  </li>
</ul>
<script>
angular.module('myApp', []).controller('namesCtrl', function($scope) {
    $scope.names = [
        {name:'aaaaaa',rollno:'1'},
        {name:'aabbbb',rollno:'2'},
        {name:'aabbcc',rollno:'3'},
        {name:'ddeegg',rollno:'4'},
        {name:'ddeegg',rollno:'4'},
    ];
});
</script>

它显示的结果是这样的

但我想要没有重复条目的结果,例如

在您的应用中包含 angular.ui.filter.js 然后包含 ui.filters 模块

var app = angular.module('app', ['ui.filters']);

然后使用

  <ul>
    <li ng-repeat="x in names | orderBy:'-name' | unique: 'name'">
      {{ ' Name = ' + (x.name | uppercase) + ' &nbsp; &nbsp; Roll No = ' + x.rollno }}
    </li>
  </ul>

Working Plunkr这里