取消复制在$scope.filteredShows
的数据是这样的:在数组对象
[{"id":19,"show_name":"The Walking Dead","show_type":"Series","show_date":"Sun, Feb 26 2017","orig_date":"2017-02-26","season":"7","ep_val":"11","episode":"Season 7, Episode 11","watched":false},
{"id":20,"show_name":"The Walking Dead","show_type":"Series","show_date":"Sun, Mar 5 2017","orig_date":"2017-03-05","season":"7","ep_val":"12","episode":"Season 7, Episode 12","watched":false},
{"id":21,"show_name":"The Walking Dead","show_type":"Series","show_date":"Sun, Mar 12 2017","orig_date":"2017-03-12","season":"7","ep_val":"13","episode":"Season 7, Episode 13","watched":false},
{"id":22,"show_name":"The Walking Dead","show_type":"Series","show_date":"Sun, Mar 19 2017","orig_date":"2017-03-19","season":"7","ep_val":"14","episode":"Season 7, Episode 14","watched":false}]
我使用这个数据使用ng-options
来填充select
类:
ng-options='show.show_name for show in filteredShows track by show.id'
但也有不止一个因此列出的“行尸走肉”一集在下拉列表中列出了“行尸走肉”4次。我该如何去除这个数组中的重复项?
请参阅[本](http://stackoverflow.com/a/9229821/3931488)。 –
您是否使用angular-ui? –
[如何使重复过滤出重复结果]可能的重复(http://stackoverflow.com/questions/15914658/how-to-make-ng-repeat-filter-out-duplicate-results) –