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
Post a Comment