Skip to content

Commit 1cef8a9

Browse files
authored
chore: Update README.md
1 parent 2f9f89b commit 1cef8a9

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ This repository contains a list of resources to learn Angular. It includes tutor
135135
- [Auditing Angular applications](#auditing-angular-applications)
136136
- [Standalone Components](#standalone-components)
137137
- [Angular Signals](#angular-signals)
138+
- [Control Flow](#control-flow)
138139
- [Angular Animations](#angular-animations)
139140
- [Installing Angular Animations](#installing-angular-animations)
140141
- [Angular Universal](#angular-universal)
@@ -5497,6 +5498,65 @@ export class AppComponent implements OnInit {
54975498

54985499
[Back to top⤴️](#table-of-contents)
54995500

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+
55005560
## Angular Animations
55015561

55025562
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

Comments
 (0)