未知提供者:uniqueFilterProvider 在 Angular.js 中使用唯一过滤器 [英] Unknown provider: uniqueFilterProvider using unique filter in Angular.js

查看:18
本文介绍了未知提供者:uniqueFilterProvider 在 Angular.js 中使用唯一过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

<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>   

我收到以下错误

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

Error: Unknown provider: uniqueFilterProvider <- uniqueFilter

示例 JSON(封装到 $scope.currentOptions)

sample JSON (wrapped into $scope.currentOptions)

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

推荐答案

AngularJS 没有内置的 unique 过滤器.您可能正在寻找名为 AngularUI 的第三方附加库,它确实有这样的过滤器.

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

这篇关于未知提供者:uniqueFilterProvider 在 Angular.js 中使用唯一过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆