Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 1 | import './nav.scss'; |
Matteo Scandolo | f2c3ed6 | 2016-12-15 14:32:50 -0800 | [diff] [blame^] | 2 | import {IXosNavigationService, IXosNavigationRoute} from '../services/navigation'; |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 3 | |
| 4 | class NavCtrl { |
Matteo Scandolo | f2c3ed6 | 2016-12-15 14:32:50 -0800 | [diff] [blame^] | 5 | static $inject = ['$state', 'NavigationService']; |
| 6 | public routes: IXosNavigationRoute[]; |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 7 | |
Matteo Scandolo | f2c3ed6 | 2016-12-15 14:32:50 -0800 | [diff] [blame^] | 8 | constructor( |
| 9 | private $state: angular.ui.IStateService, |
| 10 | private navigationService: IXosNavigationService |
| 11 | ) { |
| 12 | this.routes = this.navigationService.query(); |
| 13 | } |
| 14 | |
| 15 | isRouteActive(route: IXosNavigationRoute) { |
| 16 | return this.$state.current.url === route.url ? 'active' : ''; |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 17 | } |
| 18 | } |
| 19 | |
| 20 | export const xosNav: angular.IComponentOptions = { |
| 21 | template: require('./nav.html'), |
| 22 | controllerAs: 'vm', |
| 23 | controller: NavCtrl |
| 24 | }; |