Reputation: 159
I am having some issues with embers transitionTo, I can't get it to pass a parameter through to a state inside context. Trying to use
test: Ember.Route.transitionTo('step', {step:1}),
But this doesn't pass the value of step in the context to the route. If I had a state 'final' and used
test: Ember.Route.transitionTo('final'),
the route final is entered, as obviously no context is passed
Working demo at http://jsfiddle.net/reubenposthuma/6p6XJ/167/
Upvotes: 1
Views: 439
Reputation: 4685
I think what you are looking for might be the router.send()
method, which accepts a second argument as context.
so if you have this defined in your router
test: Ember.Route.transitionTo('final')
Then you should be able to call
App.router.send('test', {step:1})
from wherever you want in code. That {step:1}
will then be passed as the context to the route.
Upvotes: 2
Reputation: 12011
When using Ember.Route.transitionTo('state')
, you are defining a handler, which calls router.transitionTo('state', context), where context is retrieved at runtime.
So test: Ember.Route.transitionTo('step', {step:1})
is invalid, but context in the action helper, for example {{action test controller.content}}
see http://jsfiddle.net/Sly7/6p6XJ/168/
Hope this helps
Upvotes: 2