How to access dynamic segment in a controller in Ember.js?

前端 未结 4 1459
余生分开走
余生分开走 2021-02-14 01:07

I have an example route:

this.route(\'client\', {path: \':id\'});

I can access this in my route like this:

model: function(para         


        
4条回答
  •  春和景丽
    2021-02-14 01:45

    If your id happens to be part of your model you can retrieve from the model itself. For example, if you have a route with an object Bill as a model, and the path bills/:billId, on your controller you can retrieve it this way:

    this.get('model').id

提交回复
热议问题