2
在那裏有一種方法在Ember.js
路由基本上創建一個別名路由,簡單地去與另一個路由相同的地方?我有以下定義:Ember.js路由別名
this.resource("accounts", { path: "/accounts/:account_id" }, function() {
this.route("credit", { path: "/credits/:credit_id" });
this.route("debit", { path: "/debits/:debit_id" });
this.route("refund", { path: "/refunds/:refund_id" });
this.route("hold", { path: "/holds/:hold_id" });
});
工作路線示例如下:
/accounts/foo-bar-account-id/credits/foo-bar-credit-id
我需要一個別名路線,雖然每件都沒有帳戶,應在形式工作:
/credits/:credit_id
/debits/:debit_id
/refunds/:refund_id
/holds/:hold_id
我可以做一些簡單的事嗎?
this.route("accounts.credit", { path: "/credits/:credit_id" });
this.route("accounts.debit", { path: "/debits/:debit_id" });
this.route("accounts.refund", { path: "/refunds/:refund_id" });
this.route("accounts.hold", { path: "/holds/:hold_id" });
謝謝。
會的路線是什麼樣的?我需要爲每個模板重複嗎? – Justin 2013-05-14 18:15:43
嗯,我不這麼認爲,如果你正在做的唯一的事情是重定向,但還沒有測試過你的特例... – intuitivepixel 2013-05-14 18:18:06
根據模板定義,這條路線是什麼樣子? 'this.route(「what-goes-here」,{path:「/ credits /:credit_id」});' – Justin 2013-05-14 18:21:29