From 5a5435b129c7f00bb7df7d11cb0eff94fc747e90 Mon Sep 17 00:00:00 2001 From: yogeshwaran-c Date: Tue, 24 Feb 2026 02:52:52 +0530 Subject: [PATCH] docs: convert remaining @NgModule provider examples to bootstrapApplication --- src/cdk/overlay/overlay.md | 10 ++++------ src/material-experimental/README.md | 13 +++++++------ src/material/chips/chips.md | 6 +++--- src/material/form-field/form-field.md | 10 +++++----- src/material/input/input.md | 4 ++-- src/material/select/select.md | 4 ++-- src/material/stepper/stepper.md | 20 +++++++++----------- src/youtube-player/README.md | 17 +++++------------ 8 files changed, 37 insertions(+), 47 deletions(-) diff --git a/src/cdk/overlay/overlay.md b/src/cdk/overlay/overlay.md index 8030aaa6b856..0483fab5801b 100644 --- a/src/cdk/overlay/overlay.md +++ b/src/cdk/overlay/overlay.md @@ -97,11 +97,9 @@ The `FullscreenOverlayContainer` is an alternative to `OverlayContainer` that su displaying of overlay elements in [fullscreen mode](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen). -`FullscreenOverlayContainer` can be enabled by providing it in your `NgModule`: +`FullscreenOverlayContainer` can be enabled by providing it in your app config: ```ts -@NgModule({ - providers: [{provide: OverlayContainer, useClass: FullscreenOverlayContainer}], - // ... -}) -export class MyModule { } +bootstrapApplication(MyApp, { + providers: [{provide: OverlayContainer, useClass: FullscreenOverlayContainer}] +}); ``` diff --git a/src/material-experimental/README.md b/src/material-experimental/README.md index a188a1d82f49..2baa9a84d5fa 100644 --- a/src/material-experimental/README.md +++ b/src/material-experimental/README.md @@ -30,15 +30,16 @@ component by following these steps: ... ``` -3. Import the `NgModule` for the component you want to use. For example, the checkbox: +3. Import the component you want to use. For example, the checkbox: ```ts - import {MatCheckboxModule} from '@angular/material/checkbox'; + import {Component} from '@angular/core'; + import {MatCheckbox} from '@angular/material/checkbox'; - @NgModule({ - declarations: [MyComponent], - imports: [MatCheckboxModule], + @Component({ + imports: [MatCheckbox], + // ... }) - export class MyModule {} + export class MyComponent {} ``` 4. Use the components just as you would the normal Angular Material components. For example, diff --git a/src/material/chips/chips.md b/src/material/chips/chips.md index 6e52171d810a..79052d9be9ae 100644 --- a/src/material/chips/chips.md +++ b/src/material/chips/chips.md @@ -111,8 +111,8 @@ By default, chips are displayed horizontally. To stack chips vertically, apply t Use the `MAT_CHIPS_DEFAULT_OPTIONS` token to specify default options for the chips module. -```html -@NgModule({ +```ts +bootstrapApplication(MyApp, { providers: [ { provide: MAT_CHIPS_DEFAULT_OPTIONS, @@ -121,7 +121,7 @@ Use the `MAT_CHIPS_DEFAULT_OPTIONS` token to specify default options for the chi } } ] -}) +}); ``` ### Interaction Patterns diff --git a/src/material/form-field/form-field.md b/src/material/form-field/form-field.md index 87e25dcec8bc..ea93a70714d0 100644 --- a/src/material/form-field/form-field.md +++ b/src/material/form-field/form-field.md @@ -27,11 +27,11 @@ Out of the box, if you do not specify an `appearance` for the `` appearance for your app. ```ts -@NgModule({ +bootstrapApplication(MyApp, { providers: [ {provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: {appearance: 'outline'}} ] -}) +}); ``` @@ -54,15 +54,15 @@ field control, or to `auto` to restore the default behavior. The floating label behavior can be adjusted globally by providing a value for -`MAT_FORM_FIELD_DEFAULT_OPTIONS` in your application's root module. Like the `floatLabel` input, +`MAT_FORM_FIELD_DEFAULT_OPTIONS` in your app config. Like the `floatLabel` input, the option can be either set to `always` or `auto`. ```ts -@NgModule({ +bootstrapApplication(MyApp, { providers: [ {provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: {floatLabel: 'always'}} ] -}) +}); ``` ### Hint labels diff --git a/src/material/input/input.md b/src/material/input/input.md index f49f312ec5f6..db811dbf68d5 100644 --- a/src/material/input/input.md +++ b/src/material/input/input.md @@ -65,11 +65,11 @@ applies to all inputs. For convenience, `ShowOnDirtyErrorStateMatcher` is availa globally cause input errors to show when the input is dirty and invalid. ```ts -@NgModule({ +bootstrapApplication(MyApp, { providers: [ {provide: ErrorStateMatcher, useClass: ShowOnDirtyErrorStateMatcher} ] -}) +}); ``` ### Auto-resizing `