Add $stickyState.reset() to ui-router-extras typings

http://christopherthielen.github.io/ui-router-extras/#/sticky
This commit is contained in:
Josh Thomas
2018-08-12 01:35:05 -06:00
parent 2025fc00e6
commit 42e2b3b365
2 changed files with 14 additions and 1 deletions
+6
View File
@@ -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;
}
/**
@@ -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