gaurav sharma gaurav sharma - 2 months ago 29
Javascript Question

Error Message Unclear :[$injector:unpr]

I have created a .html,app.js,Controller.js and Services.js.
I simply wish to publish data on html page using DI but on execution of html file I am getting an error as

angular.js:12798 Error: [$injector:unpr] http://errors.angularjs.org/1.4.12/$injector/unpr?p0=menuFactoryProvider%20%3C-%20menuFactory%20%3C-%20MenuController


app.js

'use strict'
angular.module('confusionApp',[]);


Services.js

'use strict'
angular.module('confusionApp')
.factory('menufactory',function(){...


Controller.js

'use strict';

angular.module('confusionApp')
.controller('MenuController', ['$scope', 'menuFactory',
function($scope, menuFactory){...

Answer

menuFactory should be menufactory while injecting to the controller

angular.module('confusionApp')
.controller('MenuController', ['$scope', 'menufactory',    
function($scope, menufactory){