Skip to content

docs(comps & cdk & misc): convert @NgModule providers to bootstrapApplication #32709

@michael-small

Description

@michael-small

Documentation Feedback

Problem

https://github.com/search?q=repo%3Aangular%2Fcomponents+ngModule+language%3AMarkdown&type=code&l=Markdown

Across various doc pages there are references to @NgModule based application providers.

  • Components: 13 outstanding references across 9 markdown files to @NgModule based application providers in assorted component docs
  • CDK: 2 references in 2 files
  • Material experimental: 1 reference in 1 file
  • YouTube player: 2 references in 1 file
  • Edit: after merely dropping an @ from the search, I see there is many more casual references to modules in various writeups. Maybe those are their own story, or tackled in this same proposed change?

Example: https://material.angular.dev/components/chips/overview#specifying-global-configuration-defaults

@NgModule({
  providers: [
    {
      provide: MAT_CHIPS_DEFAULT_OPTIONS,
      useValue: {
        separatorKeyCodes: [COMMA, SPACE]
      }
    }
  ]
})

New docs do use the standalone application providers syntax

Example https://material.angular.dev/components/timepicker/overview#setting-the-locale-code

bootstapApplication(MyApp, {
  providers: [{provide: MAT_DATE_LOCALE, useValue: 'en-GB'}],
});

Proposal

Convert all the module app providers examples to standalone app providers examples

Considerations

Is there any need to keep any references to module configurations anymore? IMO no, but I should ask before just making a PR.

Also, can/should these @NgModule blocks be updated without updating other module references that are inline with copy, like this:

Import the `CdkMenuModule` into the `NgModule` in which you want to create menus. You can then apply

Affected documentation page

https://material.angular.dev/components/chips/overview#specifying-global-configuration-defaults

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsThis issue is related to documentationneeds triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions