I'm new to Ember and I'm stuck with an issue that I cannot solve. I have two routes - home and lhstree. When /home is called, I need both the routes to be rendered ie. lhstree should be rendered within home template. For this purpose, I used named outlet. That worked fine. But the problem is, I need to supply data to the lhstree template. But the model hook for the lhstree template is never called. I even tried adding alert messages in the model hook, but that too is never executed. The below is my code. Any help is appreciated.
router.js
Router.map(function() {
this.route('home');
this.route('lhstree');
});
home.hbs
<html>
<head>
</head>
<body>
Home hbs rendering
</body>
</html>
home.js
export default Route.extend({
renderTemplate:function()
{
this.render();
this.render('lhstree',{outlet:'lhstree',into:'home'});
}
});
lhstree.hbs
<ul>
<li></li>
</ul>
lhstree.js
model() //THIS MODEL IS NEVER CALLED
{
return ['Player1', 'Player2'];
}
As I mentioned, the model hook of lhstree route is never called. So, the player names Player1 and Player2 are never displayed when home template is rendered.
Aucun commentaire:
Enregistrer un commentaire