1

I'm a newbie to the MEAN stack and am unclear on how to resolve an error in my AngularJS code. This is the error I keep getting:

Error: [$injector:unpr] Unknown provider: dataFilterProvider <- dataFilter

I'm not quite sure where to try to resolve the error. Perhaps my controller file:

angular.module('articles').controller('ArticlesController', ['$scope', '$routeParams', '$location', 'Authentication', 'Articles',
    function($scope, $routeParams, $location, Authentication, Articles) {

         // various $scope methods

    }
]);

Anyone have some ideas of things to look into in order to resolve this error?

UPDATE: I tracked it down to this line of one of my view.html files:

<em data-ng-bind="article.created | data:'mediumDate'"></em>

Perhaps I need to go through my model and make sure I have those values represented properly.

tonejac
  • 1,083
  • 3
  • 18
  • 32
  • It generally means somewhere you are trying to inject `dataFilter` into something, but that `dataFilter` is not a valid injectable thing. Can you show the code where you are trying to inject `dataFilter`, and if you believe it is defined, what the code is that does so? – GregL Apr 02 '15 at 06:12

3 Answers3

7

Turns out I had a small typo in this line:

<em data-ng-bind="article.created | data:'mediumDate'"></em>

I needed to change it to:

<em data-ng-bind="article.created | date:'mediumDate'"></em> // CHANGED 'data' to 'date'
tonejac
  • 1,083
  • 3
  • 18
  • 32
1

try to pass all the dependencies in module like

angular.module('articles', ['Authentication', 'Articles']).controller('ArticlesController', ['$scope', '$routeParams', '$location', 'Authentication', 'Articles',
    function($scope, $routeParams, $location, Authentication, Articles) {

         // various $scope methods

    }
]);
1

Maybe you can search dataFilter in your code and post the usage in question. I guess you may be using angularjs filter in your html? eg <div>{{user | dataFilter }}</div> And you didn't define it or it is not in the articles module.

at15
  • 139
  • 6