blob: 896ab771332bdecd6abc3994fd26871c11c1058e [file] [log] [blame]
Matteo Scandolode76a452016-04-12 09:00:04 -07001'use strict';
2
3angular.module('xos.sampleView', [
4 'ngResource',
5 'ngCookies',
6 'ngLodash',
7 'ui.router',
8 'xos.helpers'
9])
10.config(($stateProvider) => {
11 $stateProvider
12 .state('user-list', {
13 url: '/',
14 template: '<users-list></users-list>'
15 });
16})
17.config(function($httpProvider){
18 $httpProvider.interceptors.push('NoHyperlinks');
19})
20.directive('usersList', function(){
21 return {
22 restrict: 'E',
23 scope: {},
24 bindToController: true,
25 controllerAs: 'vm',
26 templateUrl: 'templates/users-list.tpl.html',
Matteo Scandolo2ef0cd72016-04-12 11:59:29 -070027 controller: function(Users){
Matteo Scandolode76a452016-04-12 09:00:04 -070028 // retrieving user list
Matteo Scandolo2ef0cd72016-04-12 11:59:29 -070029 Users.query().$promise
Matteo Scandolode76a452016-04-12 09:00:04 -070030 .then((users) => {
31 this.users = users;
32 })
33 .catch((e) => {
34 throw new Error(e);
35 });
36 }
37 };
38});