Skip to content

Commit 5579fe3

Browse files
committed
Added options.resume to transitionTo. This allows us to do some async processing in $stateChangeStart before proceeding
1 parent 5e88789 commit 5579fe3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/state.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
750750
* - **`relative`** - {object=}, When transitioning with relative path (e.g '^'),
751751
* defines which state to be relative from.
752752
* - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.
753+
* - **`resume`** - {boolean=false}, If `true` will broadcast $stateChangeSuccess event only
753754
* - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params
754755
* have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd
755756
* use this when you want to force a reload when *everything* is the same, including search params.
@@ -760,7 +761,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
760761
$state.transitionTo = function transitionTo(to, toParams, options) {
761762
toParams = toParams || {};
762763
options = extend({
763-
location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false
764+
location: true, inherit: false, relative: null, notify: true, resume: false, reload: false, $retry: false
764765
}, options || {});
765766

766767
var from = $state.$current, fromParams = $state.params, fromPath = from.path;
@@ -818,7 +819,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
818819
toParams = filterByKeys(objectKeys(to.params), toParams || {});
819820

820821
// Broadcast start event and cancel the transition if requested
821-
if (options.notify) {
822+
if (options.notify && !options.resume) {
822823
/**
823824
* @ngdoc event
824825
* @name ui.router.state.$state#$stateChangeStart
@@ -909,7 +910,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
909910
});
910911
}
911912

912-
if (options.notify) {
913+
if (options.notify || options.resume) {
913914
/**
914915
* @ngdoc event
915916
* @name ui.router.state.$state#$stateChangeSuccess

0 commit comments

Comments
 (0)