ave
ave

Reputation: 19443

How to access Ember.View property in #if helper

In the template like this

  {{#if cond}}
    a
  {{else}}
    b
  {{/if}}

is it possible in if helper in handlebars template to access properties that were defined in view?

  App.QqqqView = Ember.View.extend({
    templateName: "qqqq",
    cond: true
  });

Demo http://emberjs.jsbin.com/aZOguFIK/1/edit?html,js,output

Seems like it doesn't work, but I'm not sure why.

Upvotes: 0

Views: 33

Answers (1)

Karl-Johan Sjögren
Karl-Johan Sjögren

Reputation: 17522

You need to tell it to look in the view.

  {{#if view.cond}}
    a
  {{else}}
    b
  {{/if}}

http://emberjs.jsbin.com/aZOguFIK/2/edit

Upvotes: 1

Related Questions