Reputation: 1108
Hello I can't call a factory function. When I use it I have the next message
Here my factory
And the controller with the call
When I try to print Account, it is undefined. Can anyone see my error? Thanks
Upvotes: 1
Views: 58
Reputation: 8595
It's because Account
is not declared as a dependency of the controller. Change it to:
.controller('forgotController', ['$scope', '$location', 'Account',
function($scope, $location, Account) {
For this to work, you need to make sure Account
is available to the injector for your module. So when you declare the module that your controller is in, if it's not in the same module, be sure to include AccountService
as a module dependency. For example:
angular.module('ForgotModule', ['AccountService'])
.controller('forgotController', ['$scope', '$location', 'Account',
function($scope, $location, Account) {
Upvotes: 3