Answer the question
In order to leave comments, you need to log in
How to quickly connect angular material?
I usually include angular material like this:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
//import { HttpModule } from '@angular/http';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { AgmCoreModule } from '@agm/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatButtonModule,
MatInputModule,
MatCardModule,
MatCheckboxModule,
MatDialogModule,
MatSidenavModule } from '@angular/material';
..........
.........
imports: [
MatSidenavModule,
MatDialogModule,
MatCheckboxModule,
MatCardModule,
MatInputModule,
FormsModule,
MatButtonModule,
BrowserAnimationsModule,
HttpClientModule,
BrowserModule,
AppRoutingModule,
.............
............
.........
Answer the question
In order to leave comments, you need to log in
Do everything in a structured way, for example, to connect material in the app/shared directory, we have a material directory with 2 files:
import { NgModule } from '@angular/core';
import {
MatButtonModule,
MatInputModule,
MatCardModule,
MatCheckboxModule,
// ...
} from '@angular/material';
@NgModule({
exports: [
MatButtonModule,
MatInputModule,
MatCardModule,
MatCheckboxModule,
// ...
]
})
export class MaterialModule { }
// ...imports
import { MaterialModule } from './material';
@NgModule({
exports: [
// ...exports
MaterialModule,
]
})
export class SharedModule { }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question