页面重新加载后angularjs中的本地存储不工作
嗨,我写了下面的代码,其中我从$scope.products中的其他控制器获取值 即使在重新加载页面后,我也要存储此值 请帮忙页面重新加载后angularjs中的本地存储不工作,angularjs,angularjs-directive,local-storage,Angularjs,Angularjs Directive,Local Storage,嗨,我写了下面的代码,其中我从$scope.products中的其他控制器获取值 即使在重新加载页面后,我也要存储此值 请帮忙 app.controller("detailcntrl", function ($scope, $http, jsonService, $location, $localStorage) { $scope.products = jsonService.getData(); $scope.products = $scope.products[$scope.p
app.controller("detailcntrl", function ($scope, $http, jsonService, $location, $localStorage) {
$scope.products = jsonService.getData();
$scope.products = $scope.products[$scope.products.length-1];
$localStorage.Count = $scope.products;
console.log($localStorage.Count);
$http.get('http://www.w3schools.com/angular/customers.php').
success(function(data, status, headers, config) {
$scope.posts = data.records;
$scope.posts = $scope.posts[$scope.products];
$scope.stat = status;
if($scope.posts == "" || $scope.posts == null){
$('#Loading').hide();
$('#Error').show();
}
else
{
$('#Loading, #Error').hide();
}
}).
error(function(data, status, headers, config) {
});
$scope.welcomePage = function(){
$location.path("/welcome");
};
});
你提到过这个吗?你使用这个指令吗?我使用过这个var-app=angular.module'emnApp',['ngRoute','datatables','ngStorage'];还包括ngStorage.min.js