Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#9865 from Georadix/update-ui-route…
Browse files Browse the repository at this point in the history
…r-extras

Update ui router extras
  • Loading branch information
RyanCavanaugh authored Jun 28, 2016
2 parents 3bbe35a + 64e7805 commit d0db493
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
81 changes: 81 additions & 0 deletions ui-router-extras/ui-router-extras-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,85 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a

$stickyStateProvider.enableDebug(true);
$stateProvider.state(state);

$stateProvider.state({
name: 'test',
sticky: true,
dsr: {
default: 'substate',
params: ['param1', 'param2'],
fn: function ($dsr$) {

return $dsr$.to;
}
},
onInactivate: function ($state: angular.ui.IState) {
var iAmInjectedByInjector = $state;
},
onReactivate: function ($state: angular.ui.IState) {
var iAmInjectedByInjector = $state;
},
controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => {
$previousState.memo('test-memo1');
$previousState.memo('test-memo2', 'test-state-name2');
$previousState.memo('test-memo3', 'test-state-name3', {});
$previousState.forget('test-memo3');
$previousState.go('test-memo2', {
location: true,
notify: true
});
$previousState.get();
$previousState.get('test-memo1');

$deepstateRedirect.reset('statename1', {
'stateParam1': ['value1', 'value2'],
'stateParam2': 'value'
});
},
views: {
//named views are mandatory
'name1': {}
}
});

$stateProvider.state('name1', {
name: 'test',
sticky: true,
dsr: {
default: 'substate',
params: ['param1', 'param2'],
fn: function ($dsr$) {

return $dsr$.to;
}
},
onInactivate: function ($state: angular.ui.IState) {
var iAmInjectedByInjector = $state;
},
onReactivate: function ($state: angular.ui.IState) {
var iAmInjectedByInjector = $state;
},
controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => {
$previousState.memo('test-memo1');
$previousState.memo('test-memo2', 'test-state-name2');
$previousState.memo('test-memo3', 'test-state-name3', {});
$previousState.forget('test-memo3');
$previousState.go('test-memo2', {
location: true,
notify: true
});
$previousState.get();
$previousState.get('test-memo1');

$deepstateRedirect.reset('statename1', {
'stateParam1': ['value1', 'value2'],
'stateParam2': 'value'
});
},
views: {
//named views are mandatory
'name1': {}
}
});

});
4 changes: 4 additions & 0 deletions ui-router-extras/ui-router-extras.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,8 @@ declare namespace angular.ui {
registerStickyState(state: IStickyState): void;
}

interface IStateProvider extends angular.IServiceProvider {
state(config: IStickyState): IStateProvider;
state(name: string, config: IStickyState): IStateProvider;
}
}

0 comments on commit d0db493

Please sign in to comment.