javascript 未知提供者:uniqueFilterProvider 在 Angular.js 中使用唯一过滤器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16827300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 06:08:40  来源:igfitidea点击:

Unknown provider: uniqueFilterProvider using unique filter in Angular.js

javascripthtmlangularjsangular-uiangular-ngselect

提问by user1159790

I am new to AngularJS. I am trying to implement filtering to build a unique list of options for the select box. My code is as follows

我是 AngularJS 的新手。我正在尝试实施过滤来为选择框构建一个唯一的选项列表。我的代码如下

<select name="show-filter" id="show-filter" ng-model="card" ng-options="v for v in currentOptions.cards  | unique:'cardno'">
<option value="">All</option>
</select>   

I am getting the following error

我收到以下错误

Error: Unknown provider: uniqueFilterProvider <- uniqueFilter

错误:未知提供者:uniqueFilterProvider <- uniqueFilter

sample JSON (wrapped into $scope.currentOptions)

示例 JSON(包装为$scope.currentOptions

"cards ":[{"cardno":"123223333"},{"cardno":"123223333"},{"cardno":"123223333"}]}

回答by Dan

AngularJS does not have a built-in uniquefilter. You may be looking for the third-party add-on library called AngularUIthat does have such a filter.

AngularJS 没有内置unique过滤器。您可能正在寻找具有此类过滤器的名为AngularUI的第三方附加库。