docs-bug(MatDialog): Document standalone import
- Langage dominant
- TypeScript
- Étoiles
- 25k
- Forks
- 6.8k
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 91
Description
### 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: {
}
})
}
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par la page de documentation concernée de la Dialog API à l’adresse https://material.angular.io/components/dialog/api et examinez la manière dont elle documente actuellement MatDialogModule. L’issue demande des indications sur la manière de fournir les services de dialogue et de snackbar aux composants standalone ; le travail est considéré comme terminé lorsque la documentation explique l’approche recommandée pour les applications standalone.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- angular, typescript
- Domaine
- documentation
- Type d'issue
- Documentation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100