Search code examples
ember.jsember-cli

Ember: Binding properties in partial-templates of components


Ive got a component which has two partial-templates. In these templates Im using properties of the JS-Backend like {{myVar}}. When updating this variable in my JS (this.set('myVar', 'newValue');) the template (the partial) wont update like it is not bindet to that property in the browsers HTML.

When accessing the property in the "main" template.hbs of my component, it works fine.

Could it be that ember wont bind the helpers in the partial templates like it does in normal templates?


Solution

  • No, partials share the same scope and context as the component they are rendered within - look at the guides.

    I used partials multiple times with bindings shared between component and nested partials. If you still have problems with these bindings I advice you to use components instead of partials. The migration won't be hard (couple of lines of code).