Skip to content

Commit f41a293

Browse files
docs: edit attribute-binding doc and move colSpan note to property binding
This commit edits the copy of the attribute binding documentation, moves the colspan section that is primarily about property binding to the property binding document, and adds a docregion to the attribute-binding example to help clarify a point in the document. Part of the copy edit reformats the style precedence list in tabular format so that it is easier to read and understand.
1 parent c53f19a commit f41a293

7 files changed

Lines changed: 266 additions & 153 deletions

File tree

‎.pullapprove.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ groups:
405405
'aio/content/guide/structural-directives.md',
406406
'aio/content/examples/structural-directives/**',
407407
'aio/content/guide/svg-in-templates.md',
408+
'aio/content/guide/style-precedence.md',
408409
'aio/content/images/guide/structural-directives/**',
409410
'aio/content/guide/template-statements.md',
410411
'aio/content/guide/user-input.md',

‎aio/content/examples/attribute-binding/src/app/app.component.html‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ <h1>Attribute, class, and style bindings</h1>
33
<h2>Attribute binding</h2>
44
<!-- #docregion attrib-binding-colspan -->
55
<table border=1>
6+
<!-- #docregion colspan -->
67
<!-- expression calculates colspan=2 -->
78
<tr><td [attr.colspan]="1 + 1">One-Two</td></tr>
9+
<!-- #enddocregion colspan -->
810

911
<!-- ERROR: There is no `colspan` property to set!
1012
<tr><td colspan="{{1 + 1}}">Three-Four</td></tr>
@@ -32,31 +34,31 @@ <h2>Styling precedence</h2>
3234
<!-- #docregion basic-specificity -->
3335
<h3>Basic specificity</h3>
3436

35-
<!-- The `class.special` binding will override any value for the `special` class in `classExpr`. -->
36-
<div [class.special]="isSpecial" [class]="classExpr">Some text.</div>
37+
<!-- The `class.special` binding overrides any value for the `special` class in `classExpression`. -->
38+
<div [class.special]="isSpecial" [class]="classExpression">Some text.</div>
3739

38-
<!-- The `style.color` binding will override any value for the `color` property in `styleExpr`. -->
39-
<div [style.color]="color" [style]="styleExpr">Some text.</div>
40+
<!-- The `style.color` binding overrides any value for the `color` property in `styleExpression`. -->
41+
<div [style.color]="color" [style]="styleExpression">Some text.</div>
4042
<!-- #enddocregion basic-specificity -->
4143

4244
<!-- #docregion source-specificity -->
4345
<h3>Source specificity</h3>
4446

45-
<!-- The `class.special` template binding will override any host binding to the `special` class set by `dirWithClassBinding` or `comp-with-host-binding`.-->
47+
<!-- The `class.special` template binding overrides any host binding to the `special` class set by `dirWithClassBinding` or `comp-with-host-binding`.-->
4648
<comp-with-host-binding [class.special]="isSpecial" dirWithClassBinding>Some text.</comp-with-host-binding>
4749

48-
<!-- The `style.color` template binding will override any host binding to the `color` property set by `dirWithStyleBinding` or `comp-with-host-binding`. -->
50+
<!-- The `style.color` template binding overrides any host binding to the `color` property set by `dirWithStyleBinding` or `comp-with-host-binding`. -->
4951
<comp-with-host-binding [style.color]="color" dirWithStyleBinding>Some text.</comp-with-host-binding>
5052
<!-- #enddocregion source-specificity -->
5153

5254
<!-- #docregion dynamic-priority -->
5355
<h3>Dynamic vs static</h3>
5456

55-
<!-- If `classExpr` has a value for the `special` class, this value will override the `class="special"` below -->
56-
<div class="special" [class]="classExpr">Some text.</div>
57+
<!-- If `classExpression` has a value for the `special` class, this value overrides the `class="special"` below -->
58+
<div class="special" [class]="classExpression">Some text.</div>
5759

58-
<!-- If `styleExpr` has a value for the `color` property, this value will override the `style="color: blue"` below -->
59-
<div style="color: blue" [style]="styleExpr">Some text.</div>
60+
<!-- If `styleExpression` has a value for the `color` property, this value overrides the `style="color: blue"` below -->
61+
<div style="color: blue" [style]="styleExpression">Some text.</div>
6062

6163
<!-- #enddocregion dynamic-priority -->
6264

‎aio/content/examples/attribute-binding/src/app/app.component.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class AppComponent {
99
actionName = 'Go for it';
1010
isSpecial = true;
1111
canSave = true;
12-
classExpr = 'special clearance';
13-
styleExpr = 'color: red';
12+
classExpression = 'special clearance';
13+
styleExpression = 'color: red';
1414
color = 'blue';
1515
}

‎aio/content/examples/attribute-binding/src/app/comp-with-host-binding.component.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export class CompWithHostBindingComponent {
1111
@HostBinding('style.color')
1212
color = 'green';
1313

14+
// #docregion hostbinding
1415
@HostBinding('style.width')
1516
width = '200px';
17+
// #enddocregion hostbinding
18+
1619
}

0 commit comments

Comments
 (0)