Skip to content
This repository has been archived by the owner on Sep 20, 2020. It is now read-only.

Commit

Permalink
fix(sticky): allow empty options parameter to transitionTo()
Browse files Browse the repository at this point in the history
closes #285
  • Loading branch information
christopherthielen committed Jan 25, 2016
1 parent 83866b5 commit 1d8b1b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/stickyProvider.js
Expand Up @@ -132,7 +132,7 @@ function $StickyStateProvider($stateProvider, uirextras_coreProvider) {
var toParams = transition.toParams;
var keep = 0, state = toPath[keep];

if (transition.options.inherit) {
if (transition.options && transition.options.inherit) {
toParams = transition.toParams =
inheritParams($stateParams, toParams || {}, $state.$current, transition.toState);
}
Expand Down Expand Up @@ -206,7 +206,7 @@ function $StickyStateProvider($stateProvider, uirextras_coreProvider) {
// enter: full resolve, no special logic
// reactivate: use previous locals
// reload: like 'enter', except exit the inactive state before entering it.
var reloaded = !!transition.options.reload;
var reloaded = transition.options && !!transition.options.reload;
enteringTypes = treeChanges.entering.map(function(state) {
var type = getEnterTransition(state, transition.toParams, transition.reloadStateTree, reloaded);
reloaded = reloaded || type === 'reload';
Expand Down
6 changes: 6 additions & 0 deletions test/stickySpec.js
Expand Up @@ -195,6 +195,12 @@ describe('stickyState', function () {
testGo('A', {exited: ['A._2', 'A._1', 'A._3']});
testGo('main', { entered: ['main'], exited: ['A']});
});

it('should allow empty transitionTo options', function() {
expect(function() {
$state.transitionTo('A')
}).not.toThrow()
})
});

describe('resolve/controller function', function () {
Expand Down

0 comments on commit 1d8b1b6

Please sign in to comment.