blob: 652b55460cae8b1bd24378db8369b8b77698f5a8 [file] [log] [blame]
Matteo Scandolof2c3ed62016-12-15 14:32:50 -08001import {IXosState} from '../../../index';
2export interface IRuntimeStatesService {
Matteo Scandoloe0d71ea2016-12-19 11:56:12 -08003 addState(name: string, state: ng.ui.IState): void;
Matteo Scandolof2c3ed62016-12-15 14:32:50 -08004}
5
Matteo Scandoloe0d71ea2016-12-19 11:56:12 -08006export function RuntimeStates($stateProvider: ng.ui.IStateProvider): ng.IServiceProvider {
7 this.$get = function($state: ng.ui.IStateService) {
Matteo Scandolof2c3ed62016-12-15 14:32:50 -08008 return {
9 addState: function(name: string, state: IXosState) {
Matteo Scandolo0e363772017-01-13 11:41:29 -080010 // prevent to add multiple time the same state
11 if (!$state.get(name)) {
12 $stateProvider.state(name, state);
13 }
Matteo Scandolof2c3ed62016-12-15 14:32:50 -080014 }
15 };
16 };
17 return this;
18}