parent
05caaf987e
commit
643a5bbf63
|
@ -816,6 +816,7 @@ code-example(format="", language="html").
|
||||||
```
|
```
|
||||||
<div [ng-class]="setClasses()">This div is saveable and special</div>
|
<div [ng-class]="setClasses()">This div is saveable and special</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
<a id="ng-style"></a>
|
<a id="ng-style"></a>
|
||||||
### NgStyle
|
### NgStyle
|
||||||
We may set inline styles dynamically based on the state of the component.
|
We may set inline styles dynamically based on the state of the component.
|
||||||
|
@ -845,6 +846,7 @@ code-example(format="", language="html").
|
||||||
```
|
```
|
||||||
<div [ng-style]="setStyles()">This div is italic, normal weight, and larger</div>
|
<div [ng-style]="setStyles()">This div is italic, normal weight, and larger</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
<a id="ng-if"></a>
|
<a id="ng-if"></a>
|
||||||
### NgIf
|
### NgIf
|
||||||
We can add an element sub-tree (an element and its children) to the DOM by binding an `NgIf` directive to a truthy expression; binding to a falsey expression removes the element sub-tree from the DOM.
|
We can add an element sub-tree (an element and its children) to the DOM by binding an `NgIf` directive to a truthy expression; binding to a falsey expression removes the element sub-tree from the DOM.
|
||||||
|
@ -879,8 +881,9 @@ code-example(format="", language="html").
|
||||||
When `NgIf` is `false`, Angular physically removes the element sub-tree from the DOM. It destroys components in the sub-tree along with their state which may free up substantial resources resulting in better performance for the user.
|
When `NgIf` is `false`, Angular physically removes the element sub-tree from the DOM. It destroys components in the sub-tree along with their state which may free up substantial resources resulting in better performance for the user.
|
||||||
|
|
||||||
The show/hide technique is probably fine for small element trees. We should be wary when hiding large trees; `NgIf` may be the safer choice. Always measure before leaping to conclusions.
|
The show/hide technique is probably fine for small element trees. We should be wary when hiding large trees; `NgIf` may be the safer choice. Always measure before leaping to conclusions.
|
||||||
|
|
||||||
<a id="ng-switch"></a>
|
<a id="ng-switch"></a>
|
||||||
NgSwitch
|
### NgSwitch
|
||||||
We bind to `NgSwitch` when we want to insert one element sub-tree (an element and its children) into the DOM from a set of alternative sub-trees.
|
We bind to `NgSwitch` when we want to insert one element sub-tree (an element and its children) into the DOM from a set of alternative sub-trees.
|
||||||
|
|
||||||
Here’s an example:
|
Here’s an example:
|
||||||
|
|
Loading…
Reference in New Issue