Javascript 表中的值在更新AngularJS中的$localStorage数据后未得到更新

Javascript 表中的值在更新AngularJS中的$localStorage数据后未得到更新,javascript,angularjs,html,local-storage,ng-storage,Javascript,Angularjs,Html,Local Storage,Ng Storage,我在AngularJS中有两个组件。一个组件usersList包含一个表 <table> <tbody> <tr ng-repeat="..."><!--Contains code to repeat the entries in usersList localstorage object--></tr> </tbody> </table> 因此,基本上,我通过调用API来编辑用户详细信息和删除

我在AngularJS中有两个组件。一个组件
usersList
包含一个表

<table>
  <tbody>
    <tr ng-repeat="..."><!--Contains code to repeat the entries in usersList localstorage object--></tr>
  </tbody>
</table>
因此,基本上,我通过调用API来编辑用户详细信息和删除用户,当编辑/删除成功时,我刷新usersList的$localStorage值,这是一个JSON对象

在数据更新之前,一切都会正常工作,但是这些更改不会反映在usersList组件中。我这样做是为了保存对API的调用,以便只显示数据。欢迎提出任何其他想法

看看这个工作原理

似乎应该在
$scope
中传递
$localStorage

在纯ol'JavaScript中,通过引用$scope下的钩子传递$localStorage(或$sessionStorage)


您的问题可能来自
vm.$storage
分配

什么是$storage和$localstorage?我使用的是ngStorage$storage和$localStorage与ngStorage相关。别忘了提及:)这很有效!但我克服了这个问题,在ngStorage值上使用了$watch,即usersList
app.component("editUserProfile", {
  ...
  controller: function($localStorage, ...) {
    vm.$storage = $localStorage;
    // Do other things
    // Some event (edit) is successful, update the userslist in $localStorage
    vm.$storage.usersList = response
  }
})
var app = angular.module('app', ['ngStorage']);

app.controller('mainCtrl', function($scope, $localStorage){
  $scope.$storage = $localStorage;

  $scope.$storage.entity = [];

  $scope.add = function(){
    $scope.$storage.entity.push('New entry');
  }

});