Handlebars partials & Ember

by rlivsey

HTML

<script src="https://github.com/downloads/emberjs/ember.js/ember-0.9.7.js"></script>
<script type="text/x-handlebars">
    {{#view App.PersonView}}
        <p>A template which uses a partial:</p>
        <p>
            {{> personDetails}}
        </p>
    {{/view}}
</script>

JavaScript

App = Ember.Application.create({});

// basic access to the content of the view works fine:
Handlebars.registerPartial("personDetails", "{{content.name}}")

// logic doesn't appear to work:
// Uncaught TypeError: Cannot read property '0' of undefined 
// Handlebars.registerPartial("personDetails", "{{#if content.name}}{{content.name}}{{/if}}")

// neither does accessing view properties:
// Uncaught Error: Handlebars error: Could not find property 'upperCaseName' on object <(subclass of App.PersonView):ember153>. 
// Handlebars.registerPartial("personDetails", "{{upperCaseName}}")
       
App.PersonView = Ember.View.extend({
    content: Ember.Object.create({name: "Bob"}),
    upperCaseName: function() {
        return this.getPath("content.name").toUpperCase();
    }.property("content.name").cacheable()
});