Closed kgudipati closed 8 years ago
Can you try changing
.factory ('ShoppingListService', [function ($localStorage) {
to
.factory ('ShoppingListService', ['$localStorage', function ($localStorage) {
Also be sure to have included ngStorage as a dependency for you module/app.
No response from user.
FWIW I had a similar issue which ['$localStorage', function ($localStorage) {
solved. Might be because I'm new to Angular but it wasn't immediately obvious to me what the issue was.
Here is my Storage Factory: angular.module('starter.services')
.factory ('ShoppingListService', [function ($localStorage) {
}]);
When my controller tries to call the Service and get the shopping list: $scope.shopping_list = ShoppingListService.getAll();
I'm getting the error: Error: undefined is not an object (evaluating '$localStorage.$default')
I injected the module in my app.js and properly inject my service to my controller, but I don't seem to understand what the problem is.