docs-bug(MatDialog): Document standalone import
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 91
説明
### Documentation Feedback
TLDR; would be nice to document how to provide dialog and snackbar for standalone components.
I don't want to provide MatDialogModule for every standalone component that uses a dialog.
I guess I could add it to main.ts. I have a convenience service that does alert(), confirm(), error() dialogs and hides the MatDialogModule from simple components. I don't have a great way of providing MatDialogModule for this convenience service.
in the [docs](https://material.angular.io/components/dialog/api) it says:
`import {MatDialogModule} from '@angular/material/dialog';`
now that i'm using standalone components,
is it recommend to use:
`importProvidersFrom(MatDialogModule),`
in main.ts
e.g.
```
bootstrapApplication(AppComponent, {
providers: [
// https://this-is-angular.github.io/angular-guides/docs/standalone-apis/configuring-the-router-using-standalone-features
provideRouter(
routes,
withDebugTracing()),
importProvidersFrom(HttpClientModule),
importProvidersFrom(MatDialogModule),
provideAnimations(),
]
}).catch(err => console.error(err));
```
I guess it wouldn't make sense to provide MatDialogModule to the convenience service separately to how I provide it to some standalone components, as then perhaps the app would have inconsistent dialogs, so in main.ts makes sense, just feels disorganised.
### Affected documentation page
https://material.angular.io/components/dialog/api
p.s
also worth mentioning, fyi, sometimes we have to explicitly import our components to avoid errors, but we don't have any entrypoints or anything:
```
async serviceMethodThatOpensDialog(
) {
const { SparkplugbDatapointBulkCreateComponent } = await import('../datapoint-sparkplugb/sparkplugb-datapoint-bulk-create/sparkplugb-datapoint-bulk-create.component'
)
return this.dialog.open(SparkplugbDatapointBulkCreateComponent, {
data: {
}
})
}
```
コントリビューションガイド
調査の方向性
https://material.angular.io/components/dialog/api の該当する Dialog API ドキュメントページから始め、現在 MatDialogModule がどのように記載されているかを確認してください。Issue では、standalone コンポーネントに dialog と snackbar のサービスを提供する方法についてのガイダンスを求めています。ドキュメントで standalone アプリに推奨されるアプローチを説明できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100