Introduce unfoundState type from $stateNotFound event (#8894)

This commit is contained in:
mmmichl
2016-04-12 22:47:57 +09:00
committed by Masahiro Wakame
parent 7612f0e546
commit bf263437d0
2 changed files with 17 additions and 0 deletions
@@ -141,6 +141,8 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
private $state: ng.ui.IStateService
) {
$rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event));
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
this.onStateNotFound(event, unfoundState, fromState, fromParams));
}
public currentUser: any;
@@ -162,6 +164,15 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
});
}
}
private onStateNotFound(event: ng.IAngularEvent,
unfoundState: ng.ui.IUnfoundState,
fromState: ng.ui.IState,
fromParams: {}) {
var unfoundTo: string = unfoundState.to;
var unfoundToParams: {} = unfoundState.toParams;
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
}
private stateServiceTest() {
this.$state.go("myState");
+6
View File
@@ -100,6 +100,12 @@ declare namespace angular.ui {
cache?: boolean;
}
interface IUnfoundState {
to: string,
toParams: {},
options: IStateOptions
}
interface IStateProvider extends angular.IServiceProvider {
state(name:string, config:IState): IStateProvider;
state(config:IState): IStateProvider;