This code works; the getData() function is invoked:
var app = angular.module('POC', []);
app.controller('POCCtrl', ['$scope','$timeout', function ($scope, $timeout) {
<snip>
$timeout(function () {
$scope.getData()
}, 250, $scope);
]);
But the code below , which references localStorageService, causes a native error in IE when I try to run and debug the page. The getData() function is never invoked. What am I missing? Does the local storage service have to be included in the module too?
var app = angular.module('POC', []);
app.controller('POCCtrl', ['$scope','$timeout', 'localStorageService',
function ($scope, $timeout, localStorageService) {
$timeout(function () {
$scope.getData()
}, 250, $scope);
]);
use
I don't know why but the controller just doesn't take
localStorageServicein the way you are using, I had the same error today. See my question (I am myself looking for an explanation though)Error in angular-js while using angular-local-storage