Emberjs: transitionToRoute in the same route with different model value
Asked Answered
T

1

7

I have an Ember application composed from 3 routes:

  1. router.route('territory', { path: 'localhost/app/territory/:tid' });

  2. router.route('aggregator', { path: localhost/app/territory/:tid:/aggregator/:aid' });

  3. router.route(territory, { path: 'localhost/app/territory/:tid/aggregator/:aid/item/:iid' });

the possibles transition are from territory to aggregator, from aggregator to item, and from item to a sub item. The sub item use the same route (the 3rd), just changing the iID value in the model of route.

I had created an action that allows the user to move into a particular route with some logic and at the end run the command:

model={
    tid: "ttt"
    aid: "aaa"
    iid: "iii"
}

destination = 'item'; //the name of item route

controller.transitionToRoute(destination, model);

If I'm in the item route and I want to move to an other item, the URL will update, but not the content of the page. Obviously if I refresh the page with the generate URL the content will update.

Where is the problem? in the transition method that is Deprecated, or i have to use something different?

IMPORTANT: I'm using EmberJS - V1.0.0-RC.1

Treasury answered 6/3, 2013 at 8:55 Comment(3)
I'm running into this same issue -- did you manage to figure it out?Vaginectomy
Same problem here. Ever get anywhere with this?Paulenepauletta
Possible duplicate of Ember - Transition to same route with same modelSketchy
T
0

Is not a bug is just a normal situation in emberjs because every route have model and setupController. The model function is used to retrive asynchronously from WS or Data module the necessary information (is a RSVP.Promise). When is complete the information will be passed to setupController function, where will be possible set properties of the controller connected with the view of current route. Every time that i change the value of path but not the route, only setupController will be called. To conclude, in my case, the problem was just an organisation problem of code.

Treasury answered 18/1, 2014 at 11:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.