Search code examples
ember.jsember-dataember-cliember-router

Ember dynamic router redirect


I have the blow route in my route.js file

this.route('view', {path: 'view/:id'}, function() {
  this.route('page');
  this.route('detail');
});

When I call this from my index.js route file it's not working.

this.transitionTo('/view/123/page');

It stops in the browser like /view/123 and the 'page' is not loaded. Can you anyone help me to resolve this.


Solution

  • You dont pass a path to transitionTo, but a route name and optional models.

    So you can do this:

    this.transitionTo('view.page', '123');