contacts/js/components/contactList/contactList_controller.js

20 lines
440 B
JavaScript
Raw Normal View History

2016-02-11 14:30:52 +00:00
app.controller('contactlistCtrl', ['$scope', 'ContactService', function($scope, ContactService) {
2015-10-27 17:52:09 +00:00
var ctrl = this;
2015-12-08 11:31:43 +00:00
2016-02-11 14:30:52 +00:00
ContactService.registerObserverCallback(function(contacts) {
$scope.$apply(function() {
ctrl.contacts = contacts;
});
});
ContactService.getAll().then(function(contacts) {
$scope.$apply(function(){
ctrl.contacts = contacts;
});
});
ctrl.createContact = function() {
2016-02-11 14:30:52 +00:00
ContactService.create();
2016-01-14 10:40:45 +00:00
};
2015-12-08 11:31:43 +00:00
}]);