Added child routes, and config defined routes
Change-Id: I61c5a49a330a63737312d1eb6077aab02236a44f
diff --git a/src/app/core/nav/nav.ts b/src/app/core/nav/nav.ts
index d978ef0..cd249b9 100644
--- a/src/app/core/nav/nav.ts
+++ b/src/app/core/nav/nav.ts
@@ -2,10 +2,11 @@
import {IXosNavigationService, IXosNavigationRoute} from '../services/navigation';
class NavCtrl {
- static $inject = ['$state', 'NavigationService'];
+ static $inject = ['$scope', '$state', 'NavigationService'];
public routes: IXosNavigationRoute[];
constructor(
+ private $scope: ng.IScope,
private $state: angular.ui.IStateService,
private navigationService: IXosNavigationService
) {
@@ -13,12 +14,19 @@
// - Base routes (defined from configuration based on BRAND)
// - Autogenerated routes (nested somewhere)
// - Service Routes (dynamically added)
- this.routes = this.navigationService.query();
+
+ this.$scope.$watch(() => this.navigationService.query(), (routes) => {
+ this.routes = routes;
+ });
}
isRouteActive(route: IXosNavigationRoute) {
return this.$state.current.url === route.url ? 'active' : '';
}
+
+ activateRoute(route: IXosNavigationRoute) {
+ route.opened = !route.opened;
+ }
}
export const xosNav: angular.IComponentOptions = {