You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1cef8a9
Browse filesBrowse the repository at this point in the historyBrowse files
@@ -5497,6 +5498,65 @@ export class AppComponent implements OnInit {
5497
5498
5498
5499
[Back to top⤴️](#table-of-contents)
5499
5500
5501
+
## Control Flow
5502
+
5503
+
Conditionally display content with @if, @else-if and @else
5504
+
5505
+
```html
5506
+
@if (a > b) {
5507
+
<p>{{a}} is greater than {{b}}</p>
5508
+
}
5509
+
```
5510
+
5511
+
```html
5512
+
@if (a > b) {
5513
+
{{a}} is greater than {{b}}
5514
+
} @else if (b > a) {
5515
+
{{a}} is less than {{b}}
5516
+
} @else {
5517
+
{{a}} is equal to {{b}}
5518
+
}
5519
+
```
5520
+
5521
+
Repeat content with the @for block
5522
+
5523
+
```html
5524
+
@for (item of items; track item.id) {
5525
+
{{ item.name }}
5526
+
}
5527
+
```
5528
+
5529
+
Providing a fallback for @for blocks with the @empty block
5530
+
5531
+
```html
5532
+
@for (item of items; track item.name) {
5533
+
<li> {{ item.name }}</li>
5534
+
} @empty {
5535
+
<li aria-hidden="true"> There are no items. </li>
5536
+
}
5537
+
```
5538
+
5539
+
Conditionally display content with the @switch block
5540
+
5541
+
```html
5542
+
@switch (userPermissions) {
5543
+
@case ('admin') {
5544
+
<app-admin-dashboard />
5545
+
}
5546
+
@case ('reviewer') {
5547
+
<app-reviewer-dashboard />
5548
+
}
5549
+
@case ('editor') {
5550
+
<app-editor-dashboard />
5551
+
}
5552
+
@default {
5553
+
<app-viewer-dashboard />
5554
+
}
5555
+
}
5556
+
```
5557
+
5558
+
[Back to top⤴️](#table-of-contents)
5559
+
5500
5560
## Angular Animations
5501
5561
5502
5562
Angular's animation system is built on CSS functionality in order to animate any property that the browser considers animatable. These properties includes positions, sizes, transforms, colors, borders etc. The Angular modules for animations are @angular/animations and @angular/platform-browser.
0 commit comments