2016-03-14 23:58:51 +00:00
|
|
|
app.controller('grouplistCtrl', function($scope, ContactService, SearchService, $routeParams) {
|
2016-02-12 12:48:46 +00:00
|
|
|
|
2016-03-15 13:52:23 +00:00
|
|
|
$scope.groups = [t('contacts', 'All contacts'), t('contacts', 'Not grouped')];
|
2016-02-12 12:48:46 +00:00
|
|
|
|
|
|
|
ContactService.getGroups().then(function(groups) {
|
2016-03-15 13:52:23 +00:00
|
|
|
$scope.groups = _.unique([t('contacts', 'All contacts'), t('contacts', 'Not grouped')].concat(groups));
|
2016-02-12 12:48:46 +00:00
|
|
|
});
|
|
|
|
|
2016-02-18 16:58:00 +00:00
|
|
|
$scope.selectedGroup = $routeParams.gid;
|
2016-02-18 16:31:46 +00:00
|
|
|
$scope.setSelected = function (selectedGroup) {
|
2016-03-14 23:58:51 +00:00
|
|
|
SearchService.cleanSearch();
|
|
|
|
$scope.selectedGroup = selectedGroup;
|
2016-02-18 16:31:46 +00:00
|
|
|
};
|
2016-03-16 19:37:40 +00:00
|
|
|
});
|