@@ -490,8 +490,8 @@ table
490490 If we must read a target element property or call one of its methods,
491491 we'll need a different technique.
492492 See the API reference for
493- [viewChild ](../api/core/index/ViewChild-decorator.html) and
494- [contentChild ](../api/core/index/ContentChild-decorator.html).
493+ [ViewChild ](../api/core/index/ViewChild-decorator.html) and
494+ [ContentChild ](../api/core/index/ContentChild-decorator.html).
495495
496496:marked
497497 ### Binding target
@@ -581,7 +581,7 @@ a(id="one-time-initialization")
581581
582582
583583:marked
584- #### Content Security
584+ #### Content security
585585 Imagine the following *malicious content*.
586586+ makeExample('template-syntax/ts/app/app.component.ts' , 'evil-title' )( format ="." )
587587:marked
@@ -599,10 +599,10 @@ figure.image-display
599599.l-main-section
600600:marked
601601 <a id="other-bindings"></a>
602- ## Attribute, Class , and Style Bindings
602+ ## Attribute, class , and style bindings
603603 The template syntax provides specialized one-way bindings for scenarios less well suited to property binding.
604604
605- ### Attribute Binding
605+ ### Attribute binding
606606 We can set the value of an attribute directly with an **attribute binding**.
607607.l-sub-section
608608 :marked
@@ -652,7 +652,7 @@ code-example(format="nocode").
652652 is to set ARIA attributes, as in this example:
653653+ makeExample('template-syntax/ts/app/app.component.html' , 'attrib-binding-aria' )( format ="." )
654654:marked
655- ### Class Binding
655+ ### Class binding
656656
657657 We can add and remove CSS class names from an element’s `class` attribute with
658658 a **class binding**.
@@ -668,9 +668,6 @@ code-example(format="nocode").
668668 We can replace that with a binding to a string of the desired class names; this is an all-or-nothing, replacement binding.
669669+ makeExample('template-syntax/ts/app/app.component.html' , 'class-binding-2' )( format ="." )
670670
671- block dart-class-binding-bug
672- //- N/A
673-
674671:marked
675672 Finally, we can bind to a specific class name.
676673 Angular adds the class when the template expression evaluates to #{_truthy}.
@@ -683,7 +680,7 @@ block dart-class-binding-bug
683680 we generally prefer the [NgClass directive](#ngClass) for managing multiple class names at the same time.
684681
685682:marked
686- ### Style Binding
683+ ### Style binding
687684
688685 We can set inline styles with a **style binding**.
689686
@@ -747,7 +744,7 @@ block style-property-name-dart-diff
747744 on [aliasing input/output properties](#aliasing-io).
748745
749746:marked
750- If the name fails to match element event or output property of a known directive,
747+ If the name fails to match an element event or an output property of a known directive,
751748 Angular reports an “unknown directive” error.
752749
753750 ### *$event* and event handling statements
@@ -778,7 +775,7 @@ block style-property-name-dart-diff
778775
779776 <a id="eventemitter"></a>
780777 <a id="custom-event"></a>
781- ### Custom Events with EventEmitter
778+ ### Custom events with * EventEmitter*
782779
783780 Directives typically raise custom events with an Angular [EventEmitter](../api/core/index/EventEmitter-class.html).
784781 The directive creates an `EventEmitter` and exposes it as a property.
@@ -853,36 +850,44 @@ block style-property-name-dart-diff
853850
854851 Angular offers a special _two-way data binding_ syntax for this purpose, **`[(x)]`**.
855852 The `[(x)]` syntax combines the brackets
856- of _Property Binding_, `[x]`, with the parentheses of _Event Binding_, `(x)`.
853+ of _property binding_, `[x]`, with the parentheses of _event binding_, `(x)`.
854+
857855.callout.is-important
858856 header [( )] = banana in a box
859857 :marked
860858 Visualize a *banana in a box* to remember that the parentheses go _inside_ the brackets.
859+
861860:marked
862861 The `[(x)]` syntax is easy to demonstrate when the element has a settable property called `x`
863862 and a corresponding event named `xChange`.
864863 Here's a `SizerComponent` that fits the pattern.
865864 It has a `size` value property and a companion `sizeChange` event:
866- + makeExample('template-syntax/ts/app/sizer.component.ts' , null , 'app/sizer.component.ts' )
865+
866+ + makeExample('app/sizer.component.ts' )
867+
867868:marked
868869 The initial `size` is an input value from a property binding.
869870 Clicking the buttons increases or decreases the `size`, within min/max values constraints,
870871 and then raises (_emits_) the `sizeChange` event with the adjusted size.
871872
872- Here's an example in which the `AppComponent.fontSize` is two-way bound to the `SizerComponent`:
873- + makeExample('template-syntax/ts/app/app.component.html' , 'two-way-1' )( format ="." )
873+ Here's an example in which the `AppComponent.fontSizePx` is two-way bound to the `SizerComponent`:
874+
875+ + makeExcerpt('app/app.component.html' , 'two-way-1' , '' )
876+
874877:marked
875- The `AppComponent.fontSize ` establishes the initial `SizerComponent.size` value.
876- Clicking the buttons updates the `AppComponent.fontSize ` via the two-way binding.
877- The revised `AppComponent.fontSize ` value flows through to the _style_ binding, making the displayed text bigger or smaller.
878- Try it in the <live-example>live example </live-example>.
878+ The `AppComponent.fontSizePx ` establishes the initial `SizerComponent.size` value.
879+ Clicking the buttons updates the `AppComponent.fontSizePx ` via the two-way binding.
880+ The revised `AppComponent.fontSizePx ` value flows through to the _style_ binding, making the displayed text bigger or smaller.
881+ Try it in the <live-example></live-example>.
879882
880883 The two-way binding syntax is really just syntactic sugar for a _property_ binding and an _event_ binding.
881884 Angular _desugars_ the `SizerComponent` binding into this:
882- + makeExample('template-syntax/ts/app/app.component.html' , 'two-way-2' )( format ="." )
885+
886+ + makeExcerpt('app/app.component.html' , 'two-way-2' , '' )
887+
883888:marked
884889 The `$event` variable contains the payload of the `SizerComponent.sizeChange` event.
885- Angular assigns the `$event` value to the `AppComponent.fontSize ` when the user clicks the buttons.
890+ Angular assigns the `$event` value to the `AppComponent.fontSizePx ` when the user clicks the buttons.
886891
887892 Clearly the two-way binding syntax is a great convenience compared to separate property and event bindings.
888893
@@ -1418,7 +1423,7 @@ h3#aliasing-io Aliasing input/output properties
14181423 Directive consumers expect to bind to the name of the directive.
14191424 For example, when we apply a directive with a `myClick` selector to a `<div>` tag,
14201425 we expect to bind to an event property that is also called `myClick`.
1421- + makeExample('template-syntax/ts/app/app.component.html' , 'my-click ' )( format ="." )
1426+ + makeExample('template-syntax/ts/app/app.component.html' , 'myClick ' )( format ="." )
14221427:marked
14231428 However, the directive name is often a poor choice for the name of a property within the directive class.
14241429 The directive name rarely describes what the property does.
@@ -1431,14 +1436,14 @@ h3#aliasing-io Aliasing input/output properties
14311436
14321437 We can specify the alias for the property name by passing it into the input/output decorator like this:
14331438
1434- + makeExample('template-syntax/ts/app/my- click.directive.ts' , 'my-click- output-1 ' )( format ="." )
1439+ + makeExample('template-syntax/ts/app/click.directive.ts' , 'output-myClick ' )( format ="." )
14351440
14361441.l-sub-section
14371442 :marked
14381443 We can also alias property names in the `inputs` and `outputs` #{_array}s.
14391444 We write a colon-delimited (`:`) string with
14401445 the directive property name on the *left* and the public alias on the *right*:
1441- + makeExample('template-syntax/ts/app/my- click.directive.ts' , 'my-click- output-2 ' )( format ="." )
1446+ + makeExample('template-syntax/ts/app/click.directive.ts' , 'output-myClick2 ' )( format ="." )
14421447
14431448<a id =" expression-operators" ></a >
14441449.l-main-section
0 commit comments