jeudi 11 février 2016

Ember transitionTo only if current route is different

In my Ember app, I initially start at the root level (/) and I have multiple links (say Link1, Link2, Link3)

Now each of these links displays a common grid i.e. I use same route/controller/template JS, but re-render the grid, by setting some attributes dynamically on the controller

Thus in my application.js, I do

this.controllerFor('my-grid').set('attr1', params[0].value);
this.controllerFor('my-grid').set('attr2', params[1].value);
this.transitionTo('my-grid');

Is this the correct way to transition ?

I mean, specifically I need

this.transitionTo('my-grid');

to be called only once (say on click of link1 from root), since after then, clicks on link2, link3 would just need a change of attribute values on my same controller and should just re-render the grid (after server api call)

Please suggest if there is some condition that I can check for calling this.transitionTo('my-grid');

Aucun commentaire:

Enregistrer un commentaire