Matteo Scandolo | 686547a | 2017-08-08 13:05:25 -0700 | [diff] [blame^] | 1 | |
| 2 | /* |
| 3 | * Copyright 2017-present Open Networking Foundation |
| 4 | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | |
Arpit Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame] | 19 | /* eslint-disable angular/ng_module_name */ |
| 20 | (function(){ |
| 21 | 'use strict'; |
Arpit Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame] | 22 | angular.module('ngXosLib', ['xos.helpers', 'ui.router']) |
Arpit Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame] | 23 | .config(($stateProvider) => { |
| 24 | $stateProvider |
| 25 | .state('form-test', { |
| 26 | url: '/form/', |
| 27 | template: '<form-test></form-test>' |
| 28 | }) |
| 29 | .state('table-test', { |
| 30 | url: '/table/', |
| 31 | template: '<table-test></table-test>' |
| 32 | }) |
| 33 | .state('alert-test', { |
| 34 | url: '/alert/', |
| 35 | template: '<alert-test></alert-test>' |
| 36 | }) |
| 37 | .state('field-test', { |
| 38 | url: '/field/', |
| 39 | template: '<field-test></field-test>' |
| 40 | }) |
Matteo Scandolo | e57712f | 2016-09-21 15:27:36 -0700 | [diff] [blame] | 41 | .state('smart-table-test', { |
| 42 | url: '/smartTable/', |
| 43 | template: '<smart-table-test></smart-table-test>' |
| 44 | }) |
Arpit Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame] | 45 | }) |
| 46 | .component('navDemo', { |
| 47 | restrict: 'E', |
| 48 | bindings: {}, |
| 49 | bindToController: true, |
| 50 | controllerAs: 'vm', |
| 51 | templateUrl: 'templates/nav.dev.html', |
| 52 | controller: function ($rootScope) { |
| 53 | |
| 54 | this.active = 'form'; |
| 55 | |
Matteo Scandolo | e57712f | 2016-09-21 15:27:36 -0700 | [diff] [blame] | 56 | $rootScope.$on('$stateChangeSuccess', (event, toState) => { |
Arpit Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame] | 57 | let strSelected = toState.url.split('/').join(''); |
| 58 | this.active = strSelected.charAt(0).toUpperCase() + strSelected.slice(1); |
| 59 | }); |
| 60 | |
| 61 | this.config = { |
| 62 | actions: [ |
| 63 | { |
| 64 | label: 'Form', |
| 65 | class: '', |
| 66 | link: '/#/form/' |
| 67 | }, |
| 68 | { |
| 69 | label: 'Field', |
| 70 | class: '', |
| 71 | link: '/#/field/' |
| 72 | |
| 73 | }, |
| 74 | { |
| 75 | label: 'Alert', |
| 76 | class: '', |
| 77 | link: '/#/alert/' |
| 78 | |
| 79 | }, |
| 80 | { |
| 81 | label: 'Table', |
| 82 | class: '', |
| 83 | link: '/#/table/' |
Matteo Scandolo | e57712f | 2016-09-21 15:27:36 -0700 | [diff] [blame] | 84 | }, |
| 85 | { |
| 86 | label: 'SmartTable', |
| 87 | class: '', |
| 88 | link: '/#/smartTable/' |
Arpit Agarwal | 4397874 | 2016-08-09 15:38:25 -0700 | [diff] [blame] | 89 | } |
| 90 | ] |
| 91 | } |
| 92 | } |
| 93 | }); |
| 94 | |
| 95 | })(); |