Help with transitionTo and parameters


#1

Hi,

I’m using a transitionTo to redirect to another route:

this.transitionTo('posts', {queryParams: {sort: 'title'}});

At posts router I can’t get the sort parameter. How can I do that ?

I’m using this:

...
	model: function(params) {
		console.log(params);
	}
...

But it doesn’t work.

Thanks.


#2

Your question is likely to be better asked over at StackOverflow, but so far I can tell you that a transitionTo() call won’t trigger the beforeModel and model hooks if you pass an object as parameter. These hooks will be bypassed and afterModel and setupController will be called immediatly as your passed object parameter will be taken as the model.

So, I myself created a Mixin which provides a createModel() and createController() method which will be called from model and/or setupController hook based on how it is invoked (hope I explained myself clear enough so you can follow :smile:)


#3

Hi, heheh It’s not much clear for me but I will take a deep look. Thanks.