In the code snippet below, I'm getting "ReferenceError: 'ShoppingListService' is undefined". I can't see what the error might be, been banging my head against it and searched for a while now, anyone have clues?
var ShoppingListApp = angular.module('ShoppingListApp', [])
ShoppingListApp.factory('ShoppingListService', ['$http', function ($http) {
var ShoppingListService = {};
ShoppingListService.getListItems = function () {
return $http.get('/ShoppingList/GetListItems');
};
return ShoppingListService;
}]);
ShoppingListApp.controller('ShoppingListController', function ($scope) {
getItems();
function getItems() {
ShoppingListService.getListItems() //Error occurs here
.success(function (shoppingItems) {
$scope.items = shoppingItems;
console.log($scope.items);
})
.[removed for brevity].
The error occurs in the area indicated above. Angular.js version 1.4.9.