当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Ember.js Routing: 'refreshModel: true' on queryParams without updating child route model

问题描述:

I would like to update a parent route on queryParams change, but not any child routes. To update my parent route on queryParam change, I use refreshModel: true.

According to: http://ember-doc.com/classes/Ember.Route.html#property_queryParams, refreshModel: true will cause child route models to refire.

Can I opt out of this behavior?

网友答案:

In case anyone has this problem, I was able to workaround it by not using the refreshModel option at all, instead opting to use the following in my parent route:

actions: {
    queryParamsDidChange: function(params) {
        // do stuff with changed params,
        this.get('controller').set('model', *maybe ajax stuff?*);
    }
}

And only using the model hook on initial route load.

分享给朋友:
您可能感兴趣的文章:
随机阅读: