Route#replaceWith()

replaceWith (name, models) Transitionpublic

Defined in packages/ember-routing/lib/system/route.js:1093

Transition into another route while replacing the current URL, if possible. This will replace the current history entry instead of adding a new one. Beside that, it is identical to transitionTo in all other respects. See 'transitionTo' for additional information regarding multiple models.

Example

App.Router.map(function() {
  this.route('index');
  this.route('secret');
});

App.SecretRoute = Ember.Route.extend({
  afterModel: function() {
    if (!authorized()){
      this.replaceWith('index');
    }
  }
});

Parameters:

name String
the name of the route or a URL
models ...Object
the model(s) or identifier(s) to be used while transitioning to the route.

Returns:

Transition
the transition object associated with this attempted transition
doc_EmberJs
2016-11-30 16:53:12
Comments
Leave a Comment

Please login to continue.