How to reload current route in Ember.js?

后端 未结 3 1535
独厮守ぢ
独厮守ぢ 2021-01-01 09:55

in Ember.js I have route with model. Could you help me, when I\'m on route playlist how to reload this route (or set new data to model) called by callback from another JS fu

3条回答
  •  攒了一身酷
    2021-01-01 10:18

    From a controller use transitionToRoute:

    this.transitionToRoute('playlist', newModel);
    

    From a route use transitionTo:

    this.transitionTo('playlist', newModel);
    

    For example, imagine you have an action on your controller

    App.PlaylistController = Ember.ArrayController.extend({
     actions: {
       grabNewModel: function(){
         //get some new model
         this.transitionToRoute('playlist', newModel);
       }
     }
    });
    

提交回复
热议问题