Skip to content

Conversation

@PhilHuot
Copy link

Having this set up (no $watch needed in the controller) we need to deep watch the tien-clndr-events attribute so that the changes in the service are reflected in the controller.

function myController(myEventService){
    this.events = myEventService.events;
    myEventService.getEvents();
}
function myEventService() {
    var self = this;
    self.events = [];
    this.getEvents = function() {
        return $http.get('/api/events').then(events) {
            angular.copy(events, self.events)
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant