diff --git a/types/ui-router-extras/index.d.ts b/types/ui-router-extras/index.d.ts index b36f030689..42f4926e87 100644 --- a/types/ui-router-extras/index.d.ts +++ b/types/ui-router-extras/index.d.ts @@ -131,6 +131,12 @@ declare module 'angular' { */ interface IStickyStateService { getInactiveStates(): IStickyState[]; + /* + * If there is an inactive state named inactiveStateName, this method exits that state. + * If stateParams is provided, then the state is only exited if the params match the inactive params. + * If inactiveStateName === '*', then all inactive states are exited + */ + reset(inactiveStateName: string, stateParams?: { [key: string]: string | string[] }): void; } /** diff --git a/types/ui-router-extras/ui-router-extras-tests.ts b/types/ui-router-extras/ui-router-extras-tests.ts index 5cc3ed122a..ef3f52ad79 100644 --- a/types/ui-router-extras/ui-router-extras-tests.ts +++ b/types/ui-router-extras/ui-router-extras-tests.ts @@ -16,7 +16,7 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a onReactivate: ($state: angular.ui.IState) => { const iAmInjectedByInjector = $state; }, - controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => { + controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService, $stickyState: angular.ui.IStickyStateService) => { $previousState.memo('test-memo1'); $previousState.memo('test-memo2', 'test-state-name2'); $previousState.memo('test-memo3', 'test-state-name3', {}); @@ -32,6 +32,13 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a stateParam1: ['value1', 'value2'], stateParam2: 'value' }); + + $stickyState.getInactiveStates(); + $stickyState.reset('state1'); + $stickyState.reset('state2', { + stateParam1: ['value1', 'value2'], + stateParam2: 'value' + }); }, views: { // named views are mandatory