0

I'd like to trigger a route change via javascript in RendrJS. My use case is that the user is on the /register page and upon a successful registration attempt I would like to direct the user to the /account page. Whats the best way to achieve this?

jaredrada
  • 1,130
  • 3
  • 12
  • 25

1 Answers1

1

Best practice in Rendr is to use redirectTo since it's isomorphic.

Inside a controller, we use:

this.redirectTo('/some/path');

Inside a view, we use:

this.app.router.redirectTo('/some/path');
Chris
  • 2,537
  • 1
  • 25
  • 22
  • this appears to update the route, call the controller init() method, call the view's init() method, but the DOM contents are not updated. Is there something else I need to do to trigger the DOM update to actually render my subsequent page? – jaredrada Nov 11 '15 at 00:01
  • @jaredrada this is all you need. You may need to check if you have a javascript/client-side error that is causing something to get interrupted and die before the new page renders. – Chris Nov 11 '15 at 03:22
  • my problem was i failed to include the id="content" on the __layout.hbs file! thanks – jaredrada Nov 11 '15 at 23:42