Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ember.js 余烬发送查询参数失败_Ember.js_Ember Router - Fatal编程技术网

Ember.js 余烬发送查询参数失败

Ember.js 余烬发送查询参数失败,ember.js,ember-router,Ember.js,Ember Router,我试图在我的道路上通过一个参数。我试着这样: route.js this.route`enter code here`('purchase', {path: '/purchase'}, function () { this.route('purchaseDetails'); this.route('purchaseEdit', {path:'purchaseEdit?country='}); //showing in the URL this.ro

我试图在我的道路上通过一个参数。我试着这样:

route.js

this.route`enter code here`('purchase', {path: '/purchase'}, function () {
        this.route('purchaseDetails');
        this.route('purchaseEdit', {path:'purchaseEdit?country='}); //showing in the URL
        this.route('purchaseReview');
        this.route('purchaseConfirmation');
      });
像这样重定向:

this.transitionTo('purchase.purchaseEdit', "SG");
但这不管用。有人纠正我吗?

解释得很好

你也可以这样做。url将显示为
../purchaseEdit/India

this.route('purchase', {path: '/purchase'}, function () {
    this.route('purchaseDetails');
    this.route('purchaseEdit', {path:'purchaseEdit/:country'}); //showing in the URL
    this.route('purchaseReview');
    this.route('purchaseConfirmation');
  });
purchaseEdit
过程中,在获取
型号时,您可以获取国家/地区的值

model:function(params)
{   
    console.log(params); //Contains the dynamic-params declared in the route as object.
    return this.store.find('purchasedItem',params.country).then(function(response){
                return response;
    },function(response){
                return "";
    });
}

只需注意-现在不推荐使用find。好的,谢谢。我在我们的项目中使用了2.12版本。为了显示用例并访问动态参数,我给出了
model
方法的一个实例。感谢您指出:)