Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
页面重新加载后angularjs中的本地存储不工作_Angularjs_Angularjs Directive_Local Storage - Fatal编程技术网

页面重新加载后angularjs中的本地存储不工作

页面重新加载后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

嗨,我写了下面的代码,其中我从$scope.products中的其他控制器获取值

即使在重新加载页面后,我也要存储此值

请帮忙

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