javascript - Ember.js routing alias -


in there way in ember.js routing create alias route goes same place route? have following defined:

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" }); }); 

an example working route looks like:

/accounts/foo-bar-account-id/credits/foo-bar-credit-id 

i need alias routes though each, without account, should work in form of:

 /credits/:credit_id  /debits/:debit_id  /refunds/:refund_id  /holds/:hold_id 

can simple as?

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" }); 

thanks.

you setup conceptually alias route redirect in redirect hook using transitionto method redirect ever route want redirected to. example:

app.indexroute = ember.route.extend({   redirect: function () {     this.transitionto('myaliasroute');   } }); 

hope helps


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -