Anglar-Material V17 and legacy-component”翻译成“Angular材料版本17和遗留组件”,可使用以下代码示例:
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import 'hammerjs';
@NgModule({ imports: [ BrowserModule, BrowserAnimationsModule, MatButtonModule, MatIconModule ], exports: [ MatButtonModule, MatIconModule ] }) export class LegacyComponentModule { }
// app.module.ts import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppComponent } from './app.component'; import { LegacyComponentModule } from './legacy-component/legacy-component.module';
@NgModule({ imports: [ BrowserModule, BrowserAnimationsModule, LegacyComponentModule ], declarations: [ AppComponent ], bootstrap: [AppComponent] }) export class AppModule { }