取消複製在$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) –