Question:
How can I include Angular Material in Angular 17?

Solution

Via CLI, Angular v17 onwards, standalone is the default


This implies that any modules will be included in new projects that you create.


As a workaround, you can use the --no-standalone flag to create a module-based application: ng new --no-standalone will create an app.modules.ts in your project. Use this command to create the module:


ng new myNewApp --no-standalone


Follow it up with :

ng add @angular/material 


Next, add the necessary modules to your project's app.module.ts from angular material:


import { MatSlideToggleModule } from '@angular/material/slide-toggle';


@NgModule ({

  imports: [

    MatSlideToggleModule,

  ]

})

class AppModule {}


Suggested blogs:

>How can I access specific data inside a JSON file on an Angular?

>HTTP request after another but only care about first one in Angular?

>Why am I getting unexpected parent reaction to child button Angular?

>How can I combine multiple HTTP calls in Angular using RxJS?

>Why Ng serve doesn't work in Angulars?

>How to use JSON:API along with Angular/RxJs?

>Why Ng server doesn't work in Angulars?

>How to operate data before return it using Angular16?

>How to Embed Node Red into existing Angular application?

>Why Angular routing with mat-toolbar is not working?

>Update Observable with value from a different Observable in Angular

>P-Dropdown doesn't set Value manually with Reactive Form in Angular

>Why Apex stacked chart bar is not showing in the x-axis in Angular?

>How can I delete the 3rdpartylicenses.txt file in Angular?


Nisha Patel

Nisha Patel

Submit
0 Answers