Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 为什么在向应用程序添加筛选器时出错?_Angularjs - Fatal编程技术网

Angularjs 为什么在向应用程序添加筛选器时出错?

Angularjs 为什么在向应用程序添加筛选器时出错?,angularjs,Angularjs,我的Angular应用程序有如下代码来添加服务: stApp.factory('entityService', ['$http', '$q', '$resource', function ( $http, $q, $resource) { 现在我刚刚添加了一个过滤器,如下所示: stApp.filter('truncate', function () { return function (value, wordwise, max, t

我的Angular应用程序有如下代码来添加服务:

stApp.factory('entityService', ['$http', '$q', '$resource', function (
                          $http, $q, $resource) {
现在我刚刚添加了一个过滤器,如下所示:

stApp.filter('truncate', function () {
    return function (value, wordwise, max, tail) {
        if (!value) return '';
调试时,我发现它在stApp.filter行中读取

但是,当我运行代码时:

{{modal.data.text | trunacate:true:15:' ...'}}
我收到一条信息说:

Error: Unknown provider: trunacateFilterProvider <- trunacateFilter
at Error (<anonymous>)
at http://127.0.0.1:81/Scripts/angular.js:2714:19
at Object.getService [as get] (http://127.0.0.1:81/Scripts/angular.js:2840:39)
at http://127.0.0.1:81/Scripts/angular.js:2719:45
at Object.getService [as get] (http://127.0.0.1:81/Scripts/angular.js:2840:39)
at $get (http://127.0.0.1:81/Scripts/angular.js:10451:24)
at filter (http://127.0.0.1:81/Scripts/angular.js:6590:14)
at _filterChain (http://127.0.0.1:81/Scripts/angular.js:6581:41)
at statements (http://127.0.0.1:81/Scripts/angular.js:6557:25)
at parser (http://127.0.0.1:81/Scripts/angular.js:6484:13) 
错误:未知提供程序:trunacateFilterProvider拼写错误

{{modal.data.text | trunacate:true:15:' ...'}}
应该是

{{modal.data.text | truncate:true:15:' ...'}}
拼写错误

{{modal.data.text | trunacate:true:15:' ...'}}
应该是

{{modal.data.text | truncate:true:15:' ...'}}

这里有输入错误:
trunacate
这里有输入错误:
trunacate