Saturday, 15 August 2015

Ember.js pre4 multiple nested routing -



Ember.js pre4 multiple nested routing -

in ember.js pre 4 i'm trying accomplish routing responds next routes (among others):

/contact/[id] /contact/edit /contact/new /contact/list /contact/list/my /contact/list/team /contact/list/groups

the first routes (up list) can manage: variants of list (my/team/groups) i'm struggling. a: "no route machted url '/contact/list/my' error when calling it.

i've tried multiple variations on how accomplish kind of nesting. current attempt:

app.router.map(function() { this.route("index"); this.resource("contact", function(){ this.route('new'); this.route('show', { path: "/:contact_id" }); this.route('edit', { path: "edit/:contact_id" }); }); this.resource("contact.list", function(){ this.route("index"); this.route("my"); }); });

looking @ app.router.router.recognizer.names: see next output:

contact.edit: object contact.index: object contact.list.index: object contact.list.my: object contact.new: object contact.show: object index: object __proto__: object

any ideas?

this seems work me:

app.router.map(function() { this.route("index"); this.resource("contact", function(){ this.route('new'); this.route('show', { path: "/:contact_id" }); this.route('edit', { path: "edit/:contact_id" }); this.resource("contact.list", { path: "list/" },function(){ this.route("index"); this.route("my"); }); }); });

ember.js

No comments:

Post a Comment