Skip to content

Commit ab17ce5

Browse files
committed
Refactoring 3rd param in $state.transitionTo() to options hash.
1 parent 6ae7820 commit ab17ce5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/state.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,13 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
205205
return this.transitionTo(toState, params, options);
206206
};
207207

208-
$state.transitionTo = function transitionTo(to, toParams, updateLocation) {
209-
if (!isDefined(updateLocation)) updateLocation = true;
208+
$state.transitionTo = function transitionTo(to, toParams, options) {
209+
if (!isDefined(options)) options = (options === true || options === false) ? { location: options } : {};
210+
options = extend({ location: true, inherit: false });
210211

211212
to = findState(to);
212213
if (to['abstract']) throw new Error("Cannot transition to abstract state '" + to + "'");
214+
213215
var toPath = to.path,
214216
from = $state.$current, fromParams = $state.params, fromPath = from.path;
215217

@@ -286,7 +288,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
286288

287289
// Update $location
288290
var toNav = to.navigable;
289-
if (updateLocation && toNav) {
291+
if (options.location && toNav) {
290292
$location.url(toNav.url.format(toNav.locals.globals.$stateParams));
291293
}
292294

0 commit comments

Comments
 (0)