Populating route search after dynamic routes have been added
Change-Id: I25ff31b3a016a020fc8c8b08f29ded700d01e203
diff --git a/conf/app/app.config.remote.ts b/conf/app/app.config.remote.ts
new file mode 100644
index 0000000..24aa42d
--- /dev/null
+++ b/conf/app/app.config.remote.ts
@@ -0,0 +1,5 @@
+import {IAppConfig} from './interfaces';
+export const AppConfig: IAppConfig = {
+ apiEndpoint: 'http://clnode031.clemson.cloudlab.us:8080/api',
+ websocketClient: 'http://clnode031.clemson.cloudlab.us:8080'
+};
diff --git a/src/app/core/header/header.ts b/src/app/core/header/header.ts
index 92d402d..88562ea 100644
--- a/src/app/core/header/header.ts
+++ b/src/app/core/header/header.ts
@@ -13,7 +13,7 @@
}
class HeaderController {
- static $inject = ['$scope', '$state', 'AuthService', 'SynchronizerStore', 'toastr', 'toastrConfig', 'NavigationService'];
+ static $inject = ['$scope', '$rootScope', '$state', 'AuthService', 'SynchronizerStore', 'toastr', 'toastrConfig', 'NavigationService'];
public notifications: INotification[] = [];
public newNotifications: INotification[] = [];
public version: string;
@@ -24,6 +24,7 @@
constructor(
private $scope: angular.IScope,
+ private $rootScope: ng.IScope,
private $state: IStateService,
private authService: IXosAuthService,
private syncStore: IStoreService,
@@ -44,8 +45,7 @@
// tapToDismiss: false
});
- // TODO set a global event after routes have been loaded
- window.setTimeout(() => {
+ this.$rootScope.$on('xos.core.modelSetup', () => {
this.states = this.NavigationService.query().reduce((list, state) => {
// if it does not have child (otherwise it is abstract)
if (!state.children || state.children.length === 0) {
@@ -60,7 +60,7 @@
return list;
}, []);
this.states = _.uniqBy(this.states, 'state');
- }, 500);
+ });
// listen for keypress
$(document).on('keyup', (e) => {
@@ -71,7 +71,6 @@
// redirect to selected page
this.routeSelected = (item: IXosNavigationRoute) => {
- console.log(`go to: ${item.state}`);
this.$state.go(item.state);
this.query = null;
};
diff --git a/src/app/core/services/helpers/model-setup.helpers.ts b/src/app/core/services/helpers/model-setup.helpers.ts
index 6a276d9..b0a2be6 100644
--- a/src/app/core/services/helpers/model-setup.helpers.ts
+++ b/src/app/core/services/helpers/model-setup.helpers.ts
@@ -11,9 +11,10 @@
}
export class ModelSetup {
- static $inject = ['$q', 'ModelDefs', 'ConfigHelpers', 'RuntimeStates', 'NavigationService'];
+ static $inject = ['$rootScope', '$q', 'ModelDefs', 'ConfigHelpers', 'RuntimeStates', 'NavigationService'];
constructor(
+ private $rootScope: ng.IScope,
private $q: ng.IQService,
private ModelDefs: ModeldefsService,
private ConfigHelpers: IXosConfigHelpersService,
@@ -52,7 +53,8 @@
parent: 'xos.core'
});
});
-
+ console.log('xos.core.modelSetup');
+ this.$rootScope.$emit('xos.core.modelSetup', {done: true});
d.resolve();
})
.catch(d.reject);