blob: d978ef0001f350f343b1526fd923b2a06baf308e [file] [log] [blame]
Matteo Scandolof6acdbe2016-12-13 10:29:37 -08001import './nav.scss';
Matteo Scandolof2c3ed62016-12-15 14:32:50 -08002import {IXosNavigationService, IXosNavigationRoute} from '../services/navigation';
Matteo Scandolof6acdbe2016-12-13 10:29:37 -08003
4class NavCtrl {
Matteo Scandolof2c3ed62016-12-15 14:32:50 -08005 static $inject = ['$state', 'NavigationService'];
6 public routes: IXosNavigationRoute[];
Matteo Scandolof6acdbe2016-12-13 10:29:37 -08007
Matteo Scandolof2c3ed62016-12-15 14:32:50 -08008 constructor(
9 private $state: angular.ui.IStateService,
10 private navigationService: IXosNavigationService
11 ) {
Matteo Scandolo3b3b3b42016-12-15 17:31:53 -080012 // NOTE we'll need to have:
13 // - Base routes (defined from configuration based on BRAND)
14 // - Autogenerated routes (nested somewhere)
15 // - Service Routes (dynamically added)
Matteo Scandolof2c3ed62016-12-15 14:32:50 -080016 this.routes = this.navigationService.query();
17 }
18
19 isRouteActive(route: IXosNavigationRoute) {
20 return this.$state.current.url === route.url ? 'active' : '';
Matteo Scandolof6acdbe2016-12-13 10:29:37 -080021 }
22}
23
24export const xosNav: angular.IComponentOptions = {
25 template: require('./nav.html'),
26 controllerAs: 'vm',
27 controller: NavCtrl
28};