javascript - $injector unable to resolve required dependency -


i'm trying habit of structuring angular projects following lift protocol (locate, identify, flat, try(dry)) i'm having difficulty resolving dependencies other files.

i have following factory:

(function () {      'use strict';      angular         .module('cbpwidget', [])         .factory('apimanufacturers', apimanufacturers);      function apimanufacturers () {          function hello () {             return 'hello';         }          return {             hello: hello         };      }  })(); 

and following controller:

(function () {      'use strict';      angular         .module('cbpwidget', [])         .controller('steponecontroller', steponecontroller);      steponecontroller.$inject = ['$scope', 'apimanufacturers'];      function steponecontroller ($scope, apimanufacturers) {          $scope.step = 'step1';         console.log(apimanufacturers.hello);      }  })(); 

and following error thrown:

error: [$injector:unpr] unknown provider: apimanufacturersprovider <- apimanufacturers <- steponecontroller 

my factory js file placed above controller js file in html (which minified).

any advice on i'm going wrong appreciated i'm new structuring projects way.

here creating cbpwidget module 2 times. angular.module('cbpwidget',[]) used creating module , angular.module('cbpwidget') used getting created module. replace controller code :

(function () {      'use strict';      angular         .module('cbpwidget')//now getting cbpwidget module         .controller('steponecontroller', steponecontroller);      steponecontroller.$inject = ['$scope', 'apimanufacturers'];      function steponecontroller ($scope, apimanufacturers) {          $scope.step = 'step1';         console.log(apimanufacturers.hello);      }  })(); 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -