Skip to content

Instantly share code, notes, and snippets.

@topherfangio
Created March 24, 2011 17:01
Show Gist options
  • Save topherfangio/885426 to your computer and use it in GitHub Desktop.
Save topherfangio/885426 to your computer and use it in GitHub Desktop.
Partially working example of using SC.TemplateView inside of an SC.ContainerView
// Run this in your console/code.
MyApp.mainPage.getPath('mainPane.containerView.testContainerView').set('nowShowing', "MyApp.testView");
MyApp.ContainerView = SC.View.extend({
childViews: 'testContainerView'.w(),
testContainerView: SC.ContainerView.extend({
layout: { height: 0, bottom: 0, left: 0, right: 0 },
contentView: SC.LabelView.extend({
layout: { top: 0, bottom: 0, left: 0, right: 0 },
value: 'Test'
})
})
})
<h1>This is the testView</h1>
{{#collection "MyApp.testCollectionView"}}
<label>testCollectionView:</label>{{content.firstname}}
{{/collection}}
MyApp.testView = SC.TemplateView.create({
templateName: 'testHandlebarsView',
});
MyApp.testCollectionView = SC.TemplateCollectionView.create({
content: [ {firstname:'Tom'}, {firstname:'Yehuda'} ]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment