Paflow
Paflow

Reputation: 2367

Error: [$injector:strictdi] is not using explicit annotation and cannot be invoked in strict mode

After upgrade to angular-ui-router 1.0.5 (from 1.0.0) I get the following:

Error: [$injector:strictdi] function(searchScope) is not using explicit annotation and cannot be invoked in strict mode

http://errors.angularjs.org/1.6.5/$injector/strictdi?p0=function(searchScope)

I understand from here that this means I

enabled strict mode, in order to detect where you forgot to use $inject or the array notation to make sure your code can be safely minified.

How is this supposed to help me finding the Error? Is it in the Defintion searchScope or is the searchScope itself wrongly injected somewhere? How can I find where?

It's definition is

.factory('searchScope', ['$location', '$rootScope', 'Query', '$http', '$stateParams', 'language', '$state',
function($location, $rootScope, Query, $http, $stateParams, language, $state) {

(angular 1.6.5)

Any suggestions?

edit

SearchScope is a service I use in a lot of services and directives. I checked all components using it and all their definitions looked like

.directive('foodirective', ['searchScope', function (searchScope) {

which seem pretty correct to me...

Upvotes: 0

Views: 1779

Answers (1)

Paflow
Paflow

Reputation: 2367

Since original commenter never claimed his points here is the correct Answer by @Estus Flask:

This probably means that a function that injects searchScope is called in some route controller or resolver that weren't called before for some reason.

That helped me to find the source of the error very soon.

Upvotes: 0

Related Questions