I have a situation in a template where I want to use an if block on a value in the parent context while inside an each block.

The code:

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

App.view = Ember.View.extend({
    foo: [1, 2, 3],
    bar: true
});

The template:

<script type="text/x-handlebars">
{{#view App.view}}
    {{#each foo}}
        {{#if bar}}
            {{this}}
        {{/if}}
    {{/each}}
{{/view}}
</script>

This does not work because names referenced inside an each loop are scoped to the element of iteration. How do you refer to things in the parent context?

Demo: http://jsfiddle.net/hekevintran/sMeyC/1/

Edit
Report