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
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
+
2015
2074
## Pipes
2016
2075
2017
2076
A pipe takes in data as input and transforms it to a desired output.
@@ -3643,7 +3702,7 @@ export class AppComponent {
3643
3702
</form>
3644
3703
```
3645
3704
3646
-
FormRecord in Angular
3705
+
FormArray in Angular
3647
3706
3648
3707
```ts
3649
3708
import { Component } from '@angular/core';
@@ -3766,6 +3825,28 @@ export class AppComponent {
3766
3825
}
3767
3826
```
3768
3827
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
+
3769
3850
[Back to top⤴️](#table-of-contents)
3770
3851
3771
3852
### Providers
@@ -5607,65 +5688,6 @@ export class AppComponent implements OnInit {
5607
5688
5608
5689
[Back to top⤴️](#table-of-contents)
5609
5690
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
-
5669
5691
## Angular Animations
5670
5692
5671
5693
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 = {
5852
5874
@tailwind utilities;
5853
5875
```
5854
5876
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
+
5855
5881
[Back to top⤴️](#table-of-contents)
5856
5882
5857
5883
## PrimeNG
@@ -5997,6 +6023,10 @@ Create new app without installing cli
0 commit comments