當我使用md-form-field
標記時,出現如下所述的一個錯誤。不工作的md-form-field並出現錯誤
錯誤是:
ERROR Error: Found the synthetic property @transitionMessages. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.
at checkNoSyntheticProp (platform-browser.es5.js:2930)
at DefaultDomRenderer2.webpackJsonp.../../../platform-browser/@angular/platform-browser.es5.js.DefaultDomRenderer2.setProperty
但我導入BrowserAnimationsModule
在.module.ts
文件,但我得到錯誤的波紋管描述:
core.es5.js:1020 ERROR Error: Uncaught (in promise): Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
at new BrowserModule (platform-browser.es5.js:4161)
at _createClass (core.es5.js:9528)
如何解決呢? 我的材料版本是@angular/[email protected]
和@angular/[email protected]
。
home.html的文件
<md-form-field>
<input type="text" mdInput >
</md-form-field>
app.module.ts文件
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CommonModule } from './common/common.module';
import { AppComponent } from './app.component';
import { AuthLayoutComponent } from './common/services/index.service';
import { AppRoutesModule } from './app.routing';
import {
SessionModule
} from './session/session.module';
import { DashboardComponent } from './dashboard/dashboard.component';
import { AuthService } from './common/services/authservice';
import { AuthGuard } from './common/services/auth-guard.service';
import { SourcesModule } from './sources/sources.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MaterialModule } from '@angular/material';
@NgModule({
declarations: [
AppComponent,
AuthLayoutComponent,
DashboardComponent
],
imports: [
CommonModule,
BrowserModule,
BrowserAnimationsModule,
FormsModule,
ReactiveFormsModule,
AppRoutesModule,
MaterialModule,
SessionModule,
SourcesModule
],
providers: [AuthGuard, AuthService],
bootstrap: [AppComponent]
})
export class AppModule { }
Ayaz,你揭露你的祕密API密鑰... –