blob: 1f495ba99fe5b644ddaa1a0567fac51c87ccface [file] [log] [blame]
Matteo Scandolo1aee1982017-02-17 08:33:23 -08001export interface IXosState extends angular.ui.IState {
2 data: {
3 model: string
4 };
5};
6
7export interface IXosRuntimeStatesService {
Matteo Scandoloe0d71ea2016-12-19 11:56:12 -08008 addState(name: string, state: ng.ui.IState): void;
Matteo Scandolof2c3ed62016-12-15 14:32:50 -08009}
10
Matteo Scandolo1aee1982017-02-17 08:33:23 -080011export function XosRuntimeStates($stateProvider: ng.ui.IStateProvider): ng.IServiceProvider {
Matteo Scandoloe0d71ea2016-12-19 11:56:12 -080012 this.$get = function($state: ng.ui.IStateService) {
Matteo Scandolof2c3ed62016-12-15 14:32:50 -080013 return {
14 addState: function(name: string, state: IXosState) {
Matteo Scandolo0e363772017-01-13 11:41:29 -080015 // prevent to add multiple time the same state
16 if (!$state.get(name)) {
17 $stateProvider.state(name, state);
18 }
Matteo Scandolof2c3ed62016-12-15 14:32:50 -080019 }
20 };
21 };
22 return this;
23}