(Dialog) Component-less alert and confirm dialogs
- 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
My proposal is to create one or two methods on the `MatDialog` provider/controller to allow component-less alert and confirm dialogs, for example:
// Alert dialog
this.dialog.alert({
title: 'Forbidden',
message: 'The resource you are trying to access is forbidden.',
okButton: 'OK'
})
// Confirm dialog
this.dialog.confirm({
title: 'Server error',
message: 'The server is currently in maintenance.',
confirmButton: 'Retry',
cancelButton: 'Cancel'
})
Alternatively, both `alert` and `confirm` could be on a single method:
this.dialog.alert({
title: 'The title',
message: 'The message',
confirmButton: 'OK', // Optional, only for confirm
dismissButton: 'Dismiss'
}).afterClose().subscribe((result: boolean) => console.log); // True if confirm, false if dismiss.
#### Use Case
Currently, we have to create a component for every dialog, event the simplest dialog. This is painful and useless in most cases. Other alternatives (what I do) is to create a `AlertService` that does it for me. But makes no sense maintain it if it could be a simple feature of `MatDialog`
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách xem xét MatDialog provider/controller hiện có và dialog flow dựa trên component hiện tại. So sánh các API alert và confirm được đề xuất, bao gồm nhãn nút và boolean close result. Công việc được xem là hoàn tất khi component-less behavior và API choice được xác định và triển khai cho cả hai dialog outcomes.
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100