Ember.js 余烬发送查询参数失败
我试图在我的道路上通过一个参数。我试着这样: route.jsEmber.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
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
方法的一个实例。感谢您指出:)