angular / angular/components

(Dialog) Component-less alert and confirm dialogs

オープン
#17,048 コメント 5 件 リアクション 21 件 担当者 0 名 GitHub で見る
area: material/dialog feature needs: discussion P5
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

#### 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`

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

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

調査の方向性

まず、既存の MatDialog provider/controller と現在の component-based dialog flow を確認します。提案されている alert API と confirm API を、button labels と boolean close result を含めて比較します。両方の dialog outcomes について、component-less behavior と API choice が定義され、実装されていれば完了です。

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

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

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

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