Arpit Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame^] | 1 | /* eslint-disable angular/ng_module_name */ |
| 2 | (function(){ |
| 3 | 'use strict'; |
| 4 | console.log('hello!'); |
| 5 | angular.module('ngXosLib', ['xos.helpers', 'ui.router']) |
| 6 | .run(function () { |
| 7 | console.info('Dev Environment ready!') |
| 8 | }) |
| 9 | .config(($stateProvider) => { |
| 10 | $stateProvider |
| 11 | .state('form-test', { |
| 12 | url: '/form/', |
| 13 | template: '<form-test></form-test>' |
| 14 | }) |
| 15 | .state('table-test', { |
| 16 | url: '/table/', |
| 17 | template: '<table-test></table-test>' |
| 18 | }) |
| 19 | .state('alert-test', { |
| 20 | url: '/alert/', |
| 21 | template: '<alert-test></alert-test>' |
| 22 | }) |
| 23 | .state('field-test', { |
| 24 | url: '/field/', |
| 25 | template: '<field-test></field-test>' |
| 26 | }) |
| 27 | }) |
| 28 | .component('navDemo', { |
| 29 | restrict: 'E', |
| 30 | bindings: {}, |
| 31 | bindToController: true, |
| 32 | controllerAs: 'vm', |
| 33 | templateUrl: 'templates/nav.dev.html', |
| 34 | controller: function ($rootScope) { |
| 35 | |
| 36 | this.active = 'form'; |
| 37 | |
| 38 | $rootScope.$on('$stateChangeSuccess', (event, toState, toParams, fromState, fromParams)=> { |
| 39 | |
| 40 | let strSelected = toState.url.split('/').join(''); |
| 41 | this.active = strSelected.charAt(0).toUpperCase() + strSelected.slice(1); |
| 42 | }); |
| 43 | |
| 44 | this.config = { |
| 45 | actions: [ |
| 46 | { |
| 47 | label: 'Form', |
| 48 | class: '', |
| 49 | link: '/#/form/' |
| 50 | }, |
| 51 | { |
| 52 | label: 'Field', |
| 53 | class: '', |
| 54 | link: '/#/field/' |
| 55 | |
| 56 | }, |
| 57 | { |
| 58 | label: 'Alert', |
| 59 | class: '', |
| 60 | link: '/#/alert/' |
| 61 | |
| 62 | }, |
| 63 | { |
| 64 | label: 'Table', |
| 65 | class: '', |
| 66 | link: '/#/table/' |
| 67 | |
| 68 | } |
| 69 | ] |
| 70 | } |
| 71 | } |
| 72 | }); |
| 73 | |
| 74 | })(); |