blob: f008e22de193c58545c5043cce4a40b825b901d1 [file] [log] [blame]
Matteo Scandolofd564432016-05-03 17:07:01 -07001'use strict';
2
3angular.module('xos.sampleView', [
4 'ngResource',
5 'ngCookies',
6 'ui.router',
7 'xos.helpers'
8])
9.config(($stateProvider) => {
10 $stateProvider
11 .state('user-list', {
12 url: '/',
13 template: '<users-list></users-list>'
14 });
15})
16.config(function($httpProvider){
17 $httpProvider.interceptors.push('NoHyperlinks');
18})
19.directive('usersList', function(){
20 return {
21 restrict: 'E',
22 scope: {},
23 bindToController: true,
24 controllerAs: 'vm',
25 templateUrl: 'templates/users-list.tpl.html',
26 controller: function(Users){
27
28 this.config = {
29 resource: 'Users',
30 groupBy: 'is_admin',
31 legend: true,
32 poll: 2,
33 labelFormatter: (labels) => {
34 console.log(labels);
35 return labels.map(l => l === 'true' ? 'Admin' : 'Non admin');
36 }
37 };
38
39 }
40 };
41});