此代码有效;getData()
调用函数:
var app = angular.module('POC', []);
app.controller('POCCtrl', ['$scope','$timeout', function ($scope, $timeout) {
<snip>
$timeout(function () {
$scope.getData()
}, 250, $scope);
]);
localStorageService
但是当我尝试运行和调试页面时,下面引用的代码会在 IE 中导致本机错误。该getData()
函数永远不会被调用。我错过了什么?本地存储服务是否也必须包含在模块中?
var app = angular.module('POC', []);
app.controller('POCCtrl', ['$scope','$timeout', 'localStorageService',
function ($scope, $timeout, localStorageService) {
$timeout(function () {
$scope.getData()
}, 250, $scope);
]);