Skip to content

Commit 4beb99a

Browse files
committed
docs: Enhance README.md with control flow examples and Tailwind CSS upgrade instructions
1 parent 5411cab commit 4beb99a

File tree

1 file changed

+97
-62
lines changed

1 file changed

+97
-62
lines changed

README.md

Lines changed: 97 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,6 +2012,65 @@ export class AppComponent {
20122012

20132013
[Stackblitz Example](https://stackblitz.com/edit/stackblitz-starters-yerwcu?file=src%2Fmain.ts)
20142014

2015+
## Control Flow
2016+
2017+
Conditionally display content with @if, @else-if and @else
2018+
2019+
```html
2020+
@if (a > b) {
2021+
<p>{{a}} is greater than {{b}}</p>
2022+
}
2023+
```
2024+
2025+
```html
2026+
@if (a > b) {
2027+
{{a}} is greater than {{b}}
2028+
} @else if (b > a) {
2029+
{{a}} is less than {{b}}
2030+
} @else {
2031+
{{a}} is equal to {{b}}
2032+
}
2033+
```
2034+
2035+
Repeat content with the @for block
2036+
2037+
```html
2038+
@for (item of items; track item.id) {
2039+
{{ item.name }}
2040+
}
2041+
```
2042+
2043+
Providing a fallback for @for blocks with the @empty block
2044+
2045+
```html
2046+
@for (item of items; track item.name) {
2047+
<li> {{ item.name }}</li>
2048+
} @empty {
2049+
<li aria-hidden="true"> There are no items. </li>
2050+
}
2051+
```
2052+
2053+
Conditionally display content with the @switch block
2054+
2055+
```html
2056+
@switch (userPermissions) {
2057+
@case ('admin') {
2058+
<app-admin-dashboard />
2059+
}
2060+
@case ('reviewer') {
2061+
<app-reviewer-dashboard />
2062+
}
2063+
@case ('editor') {
2064+
<app-editor-dashboard />
2065+
}
2066+
@default {
2067+
<app-viewer-dashboard />
2068+
}
2069+
}
2070+
```
2071+
2072+
[Back to top⤴️](#table-of-contents)
2073+
20152074
## Pipes
20162075

20172076
A pipe takes in data as input and transforms it to a desired output.
@@ -3643,7 +3702,7 @@ export class AppComponent {
36433702
</form>
36443703
```
36453704

3646-
FormRecord in Angular
3705+
FormArray in Angular
36473706

36483707
```ts
36493708
import { Component } from '@angular/core';
@@ -3766,6 +3825,28 @@ export class AppComponent {
37663825
}
37673826
```
37683827

3828+
Using `@inject` decorator is an alternative way to inject dependencies into a class.
3829+
3830+
```typescript
3831+
import { Component } from '@angular/core';
3832+
import { DataService } from './data.service';
3833+
3834+
@Component({
3835+
selector: 'my-app',
3836+
templateUrl: './app.component.html',
3837+
styleUrls: ['./app.component.css'],
3838+
})
3839+
3840+
export class AppComponent {
3841+
data: string;
3842+
private dataService = inject(DataService);
3843+
3844+
constructor() {
3845+
this.data = this.dataService.getData();
3846+
}
3847+
}
3848+
```
3849+
37693850
[Back to top⤴️](#table-of-contents)
37703851

37713852
### Providers
@@ -5607,65 +5688,6 @@ export class AppComponent implements OnInit {
56075688

56085689
[Back to top⤴️](#table-of-contents)
56095690

5610-
## Control Flow
5611-
5612-
Conditionally display content with @if, @else-if and @else
5613-
5614-
```html
5615-
@if (a > b) {
5616-
<p>{{a}} is greater than {{b}}</p>
5617-
}
5618-
```
5619-
5620-
```html
5621-
@if (a > b) {
5622-
{{a}} is greater than {{b}}
5623-
} @else if (b > a) {
5624-
{{a}} is less than {{b}}
5625-
} @else {
5626-
{{a}} is equal to {{b}}
5627-
}
5628-
```
5629-
5630-
Repeat content with the @for block
5631-
5632-
```html
5633-
@for (item of items; track item.id) {
5634-
{{ item.name }}
5635-
}
5636-
```
5637-
5638-
Providing a fallback for @for blocks with the @empty block
5639-
5640-
```html
5641-
@for (item of items; track item.name) {
5642-
<li> {{ item.name }}</li>
5643-
} @empty {
5644-
<li aria-hidden="true"> There are no items. </li>
5645-
}
5646-
```
5647-
5648-
Conditionally display content with the @switch block
5649-
5650-
```html
5651-
@switch (userPermissions) {
5652-
@case ('admin') {
5653-
<app-admin-dashboard />
5654-
}
5655-
@case ('reviewer') {
5656-
<app-reviewer-dashboard />
5657-
}
5658-
@case ('editor') {
5659-
<app-editor-dashboard />
5660-
}
5661-
@default {
5662-
<app-viewer-dashboard />
5663-
}
5664-
}
5665-
```
5666-
5667-
[Back to top⤴️](#table-of-contents)
5668-
56695691
## Angular Animations
56705692

56715693
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.
@@ -5852,6 +5874,10 @@ module.exports = {
58525874
@tailwind utilities;
58535875
```
58545876

5877+
### Upgrading Tailwind CSS
5878+
5879+
To upgrade Tailwind CSS to the latest version, follow the steps outlined in the [Tailwind CSS Upgrade Guide](https://tailwindcss.com/docs/upgrade-guide). This guide provides detailed instructions on how to update your Tailwind CSS configuration and resolve any breaking changes.
5880+
58555881
[Back to top⤴️](#table-of-contents)
58565882

58575883
## PrimeNG
@@ -5997,6 +6023,10 @@ Create new app without installing cli
59976023

59986024
```bash
59996025
npm init @angular app-name
6026+
6027+
or
6028+
6029+
npx -p @angular/cli ng new app-name
60006030
```
60016031

60026032
Component
@@ -6126,12 +6156,17 @@ ng generate environments
61266156

61276157
| Angular | Node.js | TypeScript | RxJS |
61286158
| ------------------ | ------------------------------------ | -------------- | ------------------ |
6159+
| 19.1.x | ^18.19.1 \|\| ^20.11.1 \|\| ^22.0.0 | >=5.5.0 <5.8.0 | ^6.5.3 \|\| ^7.4.0 |
6160+
| 19.0.x | ^18.19.1 \|\| ^20.11.1 \|\| ^22.0.0 | >=5.5.0 <5.7.0 | ^6.5.3 \|\| ^7.4.0 |
6161+
| 18.1.x \|\| 18.2.x | ^18.19.1 \|\| ^20.11.1 \|\| ^22.0.0 | >=5.4.0 <5.6.0 | ^6.5.3 \|\| ^7.4.0 |
61296162
| 18.0.x | ^18.19.1 \|\| ^20.11.1 \|\| ^22.0.0 | >=5.4.0 <5.5.0 | ^6.5.3 \|\| ^7.4.0 |
61306163
| 17.3.x | ^18.13.0 \|\| ^20.9.0 | >=5.2.0 <5.5.0 | ^6.5.3 \|\| ^7.4.0 |
61316164
| 17.1.x \|\| 17.2.x | ^18.13.0 \|\| ^20.9.0 | >=5.2.0 <5.4.0 | ^6.5.3 \|\| ^7.4.0 |
61326165
| 17.0.x | ^18.13.0 \|\| ^20.9.0 | >=5.2.0 <5.3.0 | ^6.5.3 \|\| ^7.4.0 |
6133-
| 16.1.x \|\| 16.2.x | ^16.14.0 \|\| ^18.10.0 | >=4.9.3 <5.2.0 | ^6.5.3 \|\| ^7.4.0 |
6134-
| 16.0.x | ^16.14.0 \|\| ^18.10.0 | >=4.9.3 <5.1.0 | ^6.5.3 \|\| ^7.4.0 |
6166+
6167+
For more detailed information on each version, you can visit the [Angular Versions](https://angular.dev/reference/versions) page.
6168+
6169+
[Back to top⤴️](#table-of-contents)
61356170

61366171
## Deploying an Angular Application
61376172

0 commit comments

Comments
 (0)