0
我有一个控制器,像这样:
angular.module('myApp')
.controller('MyCtrl', function ($scope, items, UserFactory) {
$scope.items = items;
$scope.changeItems = function (item) {
// Do something with items, in the UserFactory
UserFactory.removeItem(items);
}
}
凡items
通过在routeProvider一个resolve
返回。
如果UserFactory.removeItem
运行在像饼干或本地存储,或在模型改变的东西,什么是还更新$scope.items
我应该有UserFactory.removeItem
返回新items
最好的办法,还是应该直接做一些事情在$scope.changeItems
函数中?