Reputation: 8304
I'm trying to load a few services and controllers into an AngularJS app but I am facing an "Unknown Provider" message that I don't understand.
Unknown provider: $scope, accountManagementServiceProvider <- $scope,
accountManagementService <- RegistrationSigninControllerS/<@https:
//ajax.googleapis.com/ajax/libs/angularjs/1.3.13/an… id
My app.js is like this
var dataApp = angular.module('niwadataApp', ['ngRoute','niwaDataControllers']);
along with some config stuff and routes etc etc. Then in a separate file I define some settings and attempt to load the services/controller
dataApp.value('isEmbedded', false); //And the other 'auth' settings
dataApp.service('authenticationService', ['$http', '$q', '$rootScope', '$location', 'authTimeout', 'authTimeoutUrl', 'authUrl',AuthenticationServiceImpl]);
dataApp.factory('authenticatingProxyService', ['authenticationService', 'isEmbedded', '$http', '$q', '$window', '$rootScope', AuthenticatingProxyServiceImpl]);
dataApp.service('accountManagementService', ['$q', 'authenticatingProxyService', AccountManagementServiceImpl]);
dataApp.controller('RegistrationSigninController', ['$scope, accountManagementService', RegistrationControllerImpl]);
The classes are all defined in their own files that are loaded before app.js, e.g.
var AccountManagementServiceImpl = function($q, auth) {
According to the error message it is looking for accountManagementServiceProvider
but I've got a class called accountManagementServiceImpl
and that is what I've specified in the dataApp.service(
call. Have I missed something in the documentation that defines class names must end with 'Provider'? Which provider does it not know about? As far as I can see each controller, service and factory defines its requirements and should be able to be created.
Upvotes: 0
Views: 94
Reputation: 7829
You are missing some quotes.
Change this:
dataApp.controller('RegistrationSigninController', ['$scope, accountManagementService', RegistrationControllerImpl]);
to this:
dataApp.controller('RegistrationSigninController', ['$scope', 'accountManagementService', RegistrationControllerImpl]);
Upvotes: 2