Render Handlebars
Enter the HTML/Handlebars in the Text-area provided and click render, accomplished using Ember.ContainerView
by Unspecified
HTML
<script src="https://raw.github.com/wycats/handlebars.js/1.0.rc.2/dist/handlebars.js"></script>
<script src="https://raw.github.com/emberjs/ember.js/release-builds/ember-1.0.0-pre.4.js"></script>
<script type="text/x-handlebars">
Application Handlebars
{{view App.FoobarView contentBinding="this"}}
</script>
<script type="text/x-handlebars" data-template-name="foobar">
<button {{action setCP target="view"}}>Set</button>
<button {{action getCP target="view"}}>Get</button>
{{#with view}}
{{more}}
{{/with}}
</script>
JavaScript
App = Ember.Application.create();
App.FoobarView = Ember.View.extend({
templateName: 'foobar',
setCP: function(){
console.log("calling set");
this.set("more", 100);
},
getCP: function(){
console.log("calling get");
this.get("more");
},
more: function(){
console.log(arguments.length);
if(arguments.length === 1){
return "more";
}else{
return "less";
}
}.property().volatile()
})