I have this in my controller
$scope.activities = Activities.getAll();
$httpService.getActivities().then(function (response) {
var activities = response.data.body;
Activities.addMany(activities);
});
Now my service looks something like this:
var _activities = [];
function addMany(activities) {
if (activities instanceof Array) {
_activities = _activities.concat(activities);
}
}
and:
function getAll() {
return _activities;
}
The view does not update after getActivities resolves. I checked and the response does in fact contain new activities and they are added to the _activities array in the service.
What could be the problem and how can I make sure that the scope always changes based on the service values?
Thanks in advance.
$scope.$apply()?