angularjs - Encountering strictdi error for a controller where $inject is being used -


i have enabled strict-di on application trying prepare source code minification , working through resolving strictdi errors being thrown.

i have following controller thats throwing strictdi error, correctly annotating using $inject (i using john papa style guide too) , cannot figure out going wrong:

(function () {   'use strict';        angular         .module('app.products')         .controller('productspagecontroller', controller);        controller.$inject = ['mytoolbarservice'];        function controller(mytoolbarservice) {         mytoolbarservice.gettoolbar('main').then(function (toolbar) {           toolbar.settitle('general_terms.products');         });       }     })(); 

error: [$injector:strictdi] productspagecontroller not using explicit annotation , cannot invoked in strict mode

i have controller (below) works in same manner, , when view loads bound, no error thrown , toolbar service setting title:

(function () {   'use strict';    angular     .module('app.home')     .controller('homepagecontroller', controller);    controller.$inject = ['mytoolbarservice'];    function controller(mytoolbarservice) {     mytoolbarservice.gettoolbar('main').then(function (toolbar) {       toolbar.settitle('general_terms.welcome_message');     });   } })(); 

banging head against wall now! got suggestions?

thanks

i typically don't write di in fashion, of time pass array second argument .controller() function.

as why having issues not sure. indentation? (crazy seems).

if wanted rule out suppose try , write it:

(function () {   'use strict';    angular     .module('app.home')     .controller('homepagecontroller', ['mytoolbarservice', controller]);    function controller(mytoolbarservice) {     mytoolbarservice.gettoolbar('main').then(function (toolbar) {       toolbar.settitle('general_terms.welcome_message');     });   }  })(); 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -