1

I'm trying to make a angularjs app but it gives me an error:

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

heres the controller :

angular.module('Dashboard')
.controller('DashboardCtrl',
    ['$scope', function ($scope) {
        var dashboard = this;

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

    }]);

i didnt find what is the problem..?

1
  • You can go to the url that the error provided and see the problem: docs.angularjs.org/error/$injector/…. In your case one of controllers trying to inject the highlight filter but there is no one. Can you share with us the full code (html and other relevant js files) Commented Jun 13, 2017 at 14:02

2 Answers 2

1

As the error suggests, it appears you are using a highlight filter (probably like {{ ctrl.toto | highlight }}) which is not registered. It should be registered to a module, just like you register your controller.

Sign up to request clarification or add additional context in comments.

1 Comment

Glad this is the case. Please accept the answer to indicate your question got resolved ;) ...
0

You forgot to add empty module dependency, also since you use this keyword inside controller , then there is no need of $scope, use controller as syntax.

DEMO :

angular.module('Dashboard',[])
.controller('DashboardCtrl', function () {
        var dashboard = this;
        dashboard.toto="ddazzzz";
       // $scope.vard="ddd";
        alert(dashboard.toto);
    });
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<div ng-app="Dashboard" ng-controller="DashboardCtrl as vm">
{{vm.toto}}
</div>

2 Comments

thanks ser ..but i addes angular.module('Dashboard',[]) but it doesnt work
@fourfour: glad to help, further inject the filter in the controller as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.