angular / angular/components

Angular Material, Autocomplete loading indicator and showing text (no results found)

オープン
#18,478 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: material/autocomplete docs help wanted P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

#### Feature Description

I need to show loading when searching for data and also show text when no record is found.
I have the following html excerpt:
```html

arrow_drop_down






{{
index !== to.filterKeys.length - 1
? value[ky] + ' - '
: value[ky]
}}


{{ value }}


```

Component.ts code:
```javascript
ngOnInit(): void {
super.ngOnInit();

this._unsubscribeAll = new Subject();
this.isLoading = false;

this.result$ = this.formControl.valueChanges.pipe(
takeUntil(this._unsubscribeAll),
debounceTime(300),
startWith(''),
tap(() => {
this.isLoading = true
}),
switchMap(term => this.to.filter(term))
);
}
```

for loading, I would control it with the `tap()` method, but my problem is how to know that the request inside `switchMap(term => this.to.filter(term))` was finished, so I set the loading variable to false?

my second problem is how to show a registration message not found, when the server returns an empty array, because I am working with async.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

提供された Angular テンプレートと ngOnInit の valueChanges パイプラインから始め、Angular Material の autocomplete ドキュメントと関連する例を確認します。非同期の結果が空の場合に、autocomplete が検索中であることを視覚的に示し、結果がないことを示すメッセージを表示すれば完了です。リポジトリ内のファイルやテストは指定しません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。