I have an "optional" dynamic segment on the index route.
Navigating to the index (http://foo.com) loads the default template, index.hbs.
Navigating to a dynamic segment on the index (http://foo.com/123) loads another template, chat.hbs.
router.js
Router.map(function() {
this.route('index', { path: '/' });
this.route('index', { path: '/:room_id' });
routes/index.js
model(params) {
if (params.room_id) {
this.set('templateName', 'chat');
return params.room_id;
}
}
All is ok until using the link-to helper. Home
This generates a link to http://ift.tt/2cuVxRA instead of just http://foo.com
I have tried passing in a model to the link-to helper, but have not found a way to make it work.
Aucun commentaire:
Enregistrer un commentaire