Ember.Select content vs contentBinding

ember.js

Solution

When you use:

{{view Ember.Select content=foo ... }}

You are creating a property called `content` with the value `foo` (or the value from the property `foo`) in the View. In this case the Select. Given you are only assigning a value, nothing happens in the View if the value `foo` changes in the 'parent' context. I use this approach when I don't need bindings. i.e. When passing a generic String

{{view Ember.Select message="Mi message" ... }}

When you use:

{{view Ember.Select contentBinding="foo" ... }}

You are setting up a binding. It basically means that you connect one property with another. When one changes the other changes too. Specifically it means that a `content` property inside the View is created with the value from the property `foo`. Whenever the property `foo` changes in the 'parent' context the `content` property in the View will change as well. The same is true in the other direction, whenever the `content` property in the View is changed the `foo` property from the 'parent' context will be modified.

Another nice resource.

I hope this helps you!

Problem

The docs for Ember.Select use the following: ``` {{view Ember.Select content=foo ... }} ``` However, the guide uses the following ``` {{view Ember.Select contentBinding="foo" ... }} ``` Both work. Which is preferred and why?

Original source