Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit94e57c6

Browse files
authored
Update Firestore example to use@for and AsyncPipe (#3570)
1 parentf379433 commit94e57c6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

‎docs/install-and-setup.md‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,14 @@ Open `/src/app/app.component.ts`, and make the following changes to :
4242

4343
```ts
4444
import {Component,inject }from'@angular/core';
45+
import {AsyncPipe }from'@angular/common';
4546
import {Firestore }from'@angular/fire/firestore';
4647

4748
@Component({
4849
selector:'app-root',
4950
templateUrl:'app.component.html',
50-
styleUrls: ['app.component.css']
51+
styleUrls: ['app.component.css'],
52+
imports: [AsyncPipe],
5153
})
5254
exportclassAppComponent {
5355
firestore:Firestore=inject(Firestore);
@@ -64,11 +66,14 @@ In `/src/app/app.component.ts`:
6466

6567
```ts
6668
import {Component,inject }from'@angular/core';
67-
import {Firestore,collection,collectionData}from'@angular/fire/firestore';
69+
import {AsyncPipe}from'@angular/common';
6870
import {Observable }from'rxjs';
71+
import {Firestore,collection,collectionData }from'@angular/fire/firestore';
6972

7073
@Component({
7174
selector:'app-root',
75+
standalone:true,
76+
imports: [AsyncPipe],
7277
templateUrl:'app.component.html',
7378
styleUrls: ['app.component.css']
7479
})
@@ -87,9 +92,9 @@ Open `/src/app/app.component.html`:
8792

8893
```html
8994
<ul>
90-
<liclass="text"*ngFor="letitem of items$ | async">
91-
{{item.name}}
92-
</li>
95+
@for (item of items$ | async; track item) {
96+
<li>{{item.name }}</li>
97+
}
9398
</ul>
9499
```
95100

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp