javascript - Ember: transition to route passing the ID instead of obj -


i have route /ads/:ad_id , controller can do

this.transitiontoroute('ads.ad', adobj) 

how can similar thing time passing id instead of loaded object?

o course understand can load obj id first, ember's power in doing lost of boilerplate us.

update: so, default ember serializes model url params doing like

mode_instance -> { model_name_id: model_instance.id } 

my trivial attempt doing

this.transitiontoroute('ads.ad', { id: adobjid }) 

but when passed model object ember not re-fetch it.

so, question: have route (single ad view) depends on ad id. have id number. want transition route if entered url /ads/id

what's use case this? cases when want specify object id, have object pass transitionto. can provide more context you're trying do? think can accomplish without using object id.

in case, don't think there's way this, because when transition via transitionto(someroute, somemodel), route's model hook not called, , model pass in (somemodel) supplied directly other route hooks (setupcontroller(controller, model), redirect(model), rendertemplate(controller, model)).

see ember.js route api -- model method more details.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -