What's the proper way to access parameters from within Ember.Route. setupController?

后端 未结 2 993
谎友^
谎友^ 2021-02-07 06:44

Ember.Route.model has access to the params variable, but Ember.Route.setupController does not. This is troublesome for me, because my path

2条回答
  •  孤城傲影
    2021-02-07 07:30

    Since Ember 1.8, the Route class has a paramsFor function:

    import Route from '@ember/routing/route';
    
    export default Route.extend({
        setupController(controller) {
            this._super(...arguments);
            const params = this.paramsFor('name.of.your.route')
        }
    });
    

提交回复
热议问题