Angular Material, Autocomplete loading indicator and showing text (no results found)
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
#### 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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu từ template Angular được cung cấp và pipeline valueChanges của ngOnInit, sau đó xem lại tài liệu về autocomplete của Angular Material và các ví dụ liên quan. Hoàn tất khi autocomplete hiển thị rõ ràng rằng đang có một lượt tìm kiếm đang diễn ra và hiển thị thông báo không có kết quả khi kết quả bất đồng bộ là rỗng; không có file hoặc test nào trong repository được nêu tên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 38/100