Ember Starter

by machty

HTML

<script src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-latest.js"></script>
<!-- Handlebar template for App.CurtainView -->
<script type="text/x-handlebars" data-template-name="curtain">
    {{view App.ButtonPlayView}}
</script>

<!-- Handlebar template for App.ButtonPlayView -->
<script type="text/x-handlebars" data-template-name="button">
    CLICK ME
</script>

CoffeeScript

window.App = Em.Application.create();

App.CurtainView = Ember.View.extend
    templateName: "curtain"
    blib: ->
        console.log "Debug message"
        
App.ButtonPlayView = Ember.View.extend
    templateName: "button"
    click: ->
        # Both of these will work, the second one is safer.
        # @get('parentView').blib()
        @nearestInstanceOf(App.CurtainView).blib()
    tagName: 'button'
        
    

App.CurtainView.create().append();