Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/432.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.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
Javascript highlightFilter angularjs错误_Javascript_Angularjs - Fatal编程技术网

Javascript highlightFilter angularjs错误

Javascript highlightFilter angularjs错误,javascript,angularjs,Javascript,Angularjs,我正在尝试制作angularjs应用程序,但它给了我一个错误: Error: [$injector:unpr] http://errors.angularjs.org/1.4.14/$injector/unpr?p0=highlightFilterProvider%20%3C-%20highlightFilter at http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:6:417 at h

我正在尝试制作angularjs应用程序,但它给了我一个错误:

Error: [$injector:unpr] http://errors.angularjs.org/1.4.14/$injector/unpr?p0=highlightFilterProvider%20%3C-%20highlightFilter
at http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:6:417
at http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:41:240
at Object.d [as get] (http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:39:220)
at http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:41:314
at Object.d [as get] (http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:39:220)
at http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:150:456
at X (http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:112:209)
at http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:110:334
at p (http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:7:355)
at X (http://localhost:63342/AdminLTE-2.3.11/bower_components/angular/angular.min.js:110:313) <span ng-bind-html="item.id | highlight: $select.search" class="hide">

我没有找到问题所在。

您忘了添加
空模块依赖项
,而且由于您在控制器内使用
关键字,因此不需要
$scope
,请使用
控制器作为
语法

演示:

角度模块('仪表板',[]) .controller('DashboardCtrl',函数(){ var dashboard=此; dashboard.toto=“ddazzz”; //$scope.vard=“ddd”; 警报(dashboard.toto); });

{{vm.toto}

如错误所示,您似乎正在使用未注册的突出显示筛选器(可能类似于
{{ctrl.toto | highlight}}
)。它应该注册到模块,就像注册控制器一样。

您可以转到错误提供的url,查看问题:。在您的例子中,有一个控制器试图注入高光过滤器,但没有人。你能和我们分享完整的代码(html和其他相关的js文件)吗?谢谢。但是我添加了angular.module('Dashboard',[]),但它没有work@fourfour:很高兴提供帮助,请在控制器中进一步插入
过滤器。很高兴情况如此。请接受答案以表明您的问题已解决;)。。。
angular.module('Dashboard')
.controller('DashboardCtrl',
    ['$scope', function ($scope) {
        var dashboard = this;

        dashboard.toto="ddazzzz";
       // $scope.vard="ddd";
        alert(dashboard.toto);

    }]);