lundi 6 avril 2015

Ember Routes How To?

My problem is "simple", but I could not resolve it with Ember....


It is a Small Library App, with authors and books with those routes working fine



this.resource('books', function () {
this.route('edit', {path: '/:book_id/edit'});
this.route('show', {path: '/:book_id'});
});

this.resource('authors', function () {
this.route('new');
this.route('edit', {path: '/:author_id/edit'});
this.route('show', {path: '/:author_id'});
});


Now I want to add a route which allows me to register new books, using a link from a current author template /authors/156


The route must open a ´books/new´ template, and link the new book object with his author: ie I want to show <h1>New book from {{author.name}}</h1>


What route should I add to the existing ones ? How can I pass the author reference to the new book object ?


Thanks





Aucun commentaire:

Enregistrer un commentaire