I get the error
Unknown provider: $userProvider <- $user"
With following code:
var app = angular.module('test', []);
app.factory("user", function($scope, $http) {
var usr = {};
usr.getAllLists = function(){
return "test";
}
return usr;
});
cart.controller("MyController", ["$scope", "$http", "$user",
function ($scope, $http, user){
$scope.initialize = function(){
$scope.lists = user.getAllLists();
}
}
]);
Do you see the mistake?
Assuming cart is having dependency on app module.
It has to be user and not
$user
.Also, in factory, in place of
$scope
, use$rootScope
.