javascript - AngularJS injector problems -


i'm having [$injector:unpr] error in angularjs application.

i've looked @ link error provides me in order fix problem, sadly didn't change anything. hoping guys might able see have done wrong.

first error browser console

error: [$injector:unpr] http://errors.angularjs.org/1.4.7/$injector/unpr?p0=configprovider%20%3c-%20config%20%3c-%20navcontroller     @ error (native)     @ http://localhost:8080/simplanner/lib/angular-1.4.7/angular.min.js:6:416     @ http://localhost:8080/simplanner/lib/angular-1.4.7/angular.min.js:40:409     @ object.d [as get] (http://localhost:8080/simplanner/lib/angular-1.4.7/angular.min.js:38:394)     @ http://localhost:8080/simplanner/lib/angular-1.4.7/angular.min.js:40:483     @ d (http://localhost:8080/simplanner/lib/angular-1.4.7/angular.min.js:38:394)     @ object.e [as invoke] (http://localhost:8080/simplanner/lib/angular-1.4.7/angular.min.js:39:161)     @ p.instance (http://localhost:8080/simplanner/lib/angular-1.4.7/angular.min.js:80:207)     @ k (http://localhost:8080/simplanner/lib/angular-1.4.7/angular.min.js:61:190)     @ g (http://localhost:8080/simplanner/lib/angular-1.4.7/angular.min.js:54:410)      (anonymous function) @ angular.min.js:107     (anonymous function) @ angular.min.js:80     n.$apply @ angular.min.js:133     (anonymous function) @ angular.min.js:20     e @ angular.min.js:39d @ angular.min.js:19     zc @ angular.min.js:20zd @ angular.min.js:19     (anonymous function) @ angular.min.js:293     @ angular.min.js:174hf.c @ angular.min.js:35 


then ofcourse angular code

var config = {     ... };  var app = angular.module('simplannerapp', [         'ui.router',         'ui.bootstrap'       ]);  app.filter('capitalize', function () {     ... }) .filter('datetime', function ($filter) {     ... });  app.config(function ($stateprovider, $urlrouterprovider, $locationprovider) {     var urlbase = '/' + config.iisprojectname + '/';      $stateprovider         .state('login', {             url: "/login",             templateurl: urlbase + 'views/login.html',             controller: 'logincontroller'         })         .state('view', {             url: '/view/:view',             templateurl: urlbase + 'views/view.html',             controller: 'viewcontroller',             resolve: {                 view: function ($stateparams) {                      ...                  }             }         })         .state('404', {             url: '{path:.*}',             templateurl: urlbase + '/views/404.html',             controller: 'errorcontroller'         }); });  app.factory('sharedproperties', function () {      ...  });  app.factory('socketservice', function () {      ...  });  app.controller('errorcontroller', ['$scope', function ($scope) {     ... }]);  app.controller('logincontroller', ['$scope', '$location', 'socketservice', 'sharedproperties', function ($scope, $location, socketservice, sharedproperties) {     ... }]);  app.controller('navcontroller', ['$scope', 'config', 'sharedproperties', function ($scope, config, sharedproperties) {     ... }]);  app.controller('viewcontroller', ['$scope', '$state', '$interval', 'view', 'socketservice', function ($scope, $state, $interval, view, socketservice) {     ... }]); 

seems don't have provider called config in order inject in controller as,

app.controller('navcontroller', ['$scope', 'config', 'sharedproperties', function ($scope, config, sharedproperties) { 

remove config being inject , work. as,

app.controller('navcontroller', ['$scope', 'sharedproperties', function ($scope, sharedproperties) { 

or have define provider called config.

if expecting var config gonna inject in controller, not gonna inject. need provider type inject service, factory, value .. .


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -