blob: 417f60a712bf642df1e79588512508a87e6add3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
angular.module('contactsApp')
.controller('grouplistCtrl', function($scope, ContactService, SearchService, $routeParams) {
var ctrl = this;
ctrl.groups = [];
ContactService.getGroupList().then(function(groups) {
ctrl.groups = groups;
});
ctrl.getSelected = function() {
return $routeParams.gid;
};
// Update groupList on contact add/delete/update
ContactService.registerObserverCallback(function(ev) {
if (ev.event !== 'getFullContacts') {
$scope.$apply(function() {
ContactService.getGroupList().then(function(groups) {
ctrl.groups = groups;
});
});
}
});
ctrl.setSelected = function (selectedGroup) {
SearchService.cleanSearch();
$routeParams.gid = selectedGroup;
};
});
|