top of page

Sails JS – Production mode Error: [$injector:unpr]

  • Writer: Qasim Zee
    Qasim Zee
  • Mar 4, 2015
  • 1 min read

I just encountered another error and in production mode that angular JS controllers were not being loaded properly and I was getting the error like:

Error: [$injector:unpr] ...

To fix this, just change the declaration of your AngularJS controllers from

angular.module('MyModule').controller('MyController', [function($scope, $http, $log) { ... });

1

angular

.

module

(

'MyModule'

)

.

controller

(

'MyController'

,

[

function

(

$

scope

,

$

http

,

$

log

)

{

.

.

.

}

)

;

io

angular.module('MyModule').controller('MyController', ['$scope', '$http', '$log', function($scope, $http, $log) { ... }]);

1

angular

.

module

(

'MyModule'

)

.

controller

(

'MyController'

,

[

'$scope'

,

'$http'

,

'$log'

,

function

(

$

scope

,

$

http

,

$

log

)

{

.

.

.

}

]

)

;

And it works like a charm.

Please comment if this solution solved your problem.

Recent Posts

See All
Centos, Varnish, NGINX, Drupal

As an experiment this week I decided to change the web server of a site to NGINX, the existing web server was Apache.

 
 
 

Comentarios


bottom of page