I have a controller like so:
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);
}
}
Where items
is returned by a resolve
in the routeProvider.
If UserFactory.removeItem
operates on something like cookies or localStorage, or changes something on a model, what is the best way to also update $scope.items
Should I have the UserFactory.removeItem
return the new items
, or should I do something directly in the $scope.changeItems
function?