Lately, I've been working on updating code that resembles the following:
$scope.arrayOfThings = [];
function setArrayOfThings() {
thingsService.get().then(function (things) {
$scope.arrayOfThings = things;
});
}
$scope.$on('arrayOfThings.add', setArrayOfThings);
My goal is to transform it into something like this (leveraging the less commonly known promise integration into bindings...):
$scope.arrayOfThings = thingsService.get();
However, I'm unsure how to ensure that arrayOfThings
updates (or re-resolves) when the collection is modified from another $scope
.