Skip to content

Instantly share code, notes, and snippets.

@bstaats
Created April 6, 2011 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bstaats/905857 to your computer and use it in GitHub Desktop.
Save bstaats/905857 to your computer and use it in GitHub Desktop.
How do you get a TemplateView invoked in render (menu.js) to recognize the sub-views within?
MyApp.LoginButton = SC.TemplateView.extend({})
MyApp.ProfileButton = SC.TemplateView.extend({})
<ul>
{{#view 'MyApp.LoginButton'}}
<li>Login</li>
{{/view}}
{{#view 'MyApp.ProfileButton'}}
<li>Profile</li>
{{/view}}
</ul>
MyApp.MenuTemplateView = SC.View.extend(Ki.StatechartManager,{
render: function (context, firstTime) {
if(firstTime){
context.push( SC.TEMPLATES['menu']({sc_view:this}) );
}else{
this.invokeStateMethod('render', context, firstTime);
}
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment