In my Ember.js setup i have routes like this:
this.route('hot', { path: '/hot' });
this.route('hotpage', { path: '/hot/page/:pageid' });
First route is the front page for "hot" category, second route is for "hot" pages. So hot is category main page, hotpage are next pages in this category.
So now i would like to redirect user clicking a button to hot route outside of the Ember.js components. I use this code:
App.__container__.lookup('router:main').transitionTo("quizzes.hot");
And it works nicely.
But i need also to be able to redirect users to pages of hot category. For example to page /hot/page/4.
Since i can not find the solution to do it properly now i use this code:
document.location.href = subPageURL + "/page/" + (currentPage - 1);
But it reloads (as obvious) whole page.
So i need something like this:
App.__container__.lookup('router:main').transitionTo("quizzes.hotpage", "{pageid: 4}");
Since snipped above seems not to work properly my question is:
How to transition to a parametrised route (:pageid) from outside of Ember.js routes, views and controllers.
Aucun commentaire:
Enregistrer un commentaire