docs(template-syntax): interpolation only for strings #3041 (#3066)

This commit is contained in:
Ward Bell 2017-01-02 17:50:14 -08:00 committed by GitHub
parent f60703d2d4
commit d057f73c02
1 changed files with 3 additions and 4 deletions

View File

@ -571,15 +571,14 @@ a(id="one-time-initialization")
The following binding pairs do the same thing:
+makeExample('template-syntax/ts/app/app.component.html', 'property-binding-vs-interpolation')(format=".")
:marked
Interpolation is a convenient alternative for property binding in many cases.
In fact, Angular translates those interpolations into the corresponding property bindings
before rendering the view.
_Interpolation_ is a convenient alternative to _property binding_ in many cases.
There is no technical reason to prefer one form to the other.
When rendering data values as strings, there is no technical reason to prefer one form to the other.
We lean toward readability, which tends to favor interpolation.
We suggest establishing coding style rules and choosing the form that
both conforms to the rules and feels most natural for the task at hand.
When setting an element property to a non-string data value, you must use _property binding_.
:marked
#### Content security