Why there are not references to contentBinding or controllerBinding in Ember's Docs?


#1

Hello,

I just solved a problem related to binding content to a CollectionView. I found out that I needed to use contentBinding or controllerBinding properties (Related POST).

However, correct me if I’m wrong, but I can’t find references to these properties on Ember’s docs, but a lot of matches in this forum and Google. Is this something missed from docs or have these properties been deprecated?


#2

Any idea about this?


#3

Disclaimer: I’m new to ember and don’t actually know the answer to your question, but I found this in the docs, and it seems reasonable:

http://emberjs.com/api/classes/Ember.Binding.html

*AUTOMATIC CREATION OF BINDINGS WITH /^Binding/-NAMED PROPERTIES

You do not usually create Binding objects directly but instead describe bindings in your class or object definition using automatic binding detection.

Properties ending in a Binding suffix will be converted to Ember.Binding instances. The value of this property should be a string representing a path to another object or a custom binding instance created using Binding helpers (see “One Way Bindings”):

valueBinding: "MyApp.someController.title"

This will create a binding from MyApp.someController.title to the value property of your object instance automatically. Now the two values will be kept in sync.

Also, when the docs fail, take a look at the tests. I checked out the ember repo and grepped a few instances.

% ag -l contentBinding
benchmarks/external/backbone.html
packages/ember-handlebars/lib/helpers/collection.js
packages/ember-handlebars/tests/controls/select_test.js
packages/ember-handlebars/tests/helpers/yield_test.js
packages/ember-handlebars/tests/views/collection_view_test.js

% ag -l controllerBinding
packages/ember-handlebars/lib/helpers/view.js
packages/ember-handlebars/tests/helpers/each_test.js

#4

Thanks for your reply @jbinto.

I didn’t related that part of the Ember’s docs with my question because I didn’t explicit declare contentBinding or controllerBinding in my Controller or View.

However, I suppose that putting contentBinding or controllerBinding properties on handlebars as {{view 'pending-list' contentBinding="Controller"}} has the same effect.

Thanks