这是我的代码:
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LanguageTranslationModule } from './shared/modules/language-translation/language-translation.module'
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AuthGuard } from './shared';
import { SidebarComponent } from './layout/components/sidebar/sidebar.component';
import { HeaderComponent } from './layout/components/header/header.component';
@NgModule({
imports: [
CommonModule,
BrowserAnimationsModule,
HttpClientModule,
LanguageTranslationModule,
AppRoutingModule
],
declarations: [AppComponent,HeaderComponent,SidebarComponent],
providers: [AuthGuard],
bootstrap: [AppComponent],
exports: [
HeaderComponent,
SidebarComponent
],
})
export class AppModule {}
我不明白为什么我会得到这个异常:
错误:BrowserModule 已加载。如果您需要访问
来自延迟加载模块的常见指令,例如 NgIf 和 NgFor,
改为导入 CommonModule。错误:BrowserModule 已经
已加载。如果您需要访问常见指令,例如 NgIf 和 NgFor
从延迟加载的模块中导入
在未来的模块中我导入CommonModule
并不是BrowerModule
。有人可以帮助我吗?
Import BrowserAnimationsModule
and HttpModule
仅一次(在根模块或核心模块中)。
仅导入这些提到的模块一次(仅在应用程序模块中):
BrowserModule
, BrowserAnimationsModule
, LazyLoadImageModule
(如果使用它),CarouselModule
(如果使用它),InfiniteScrollModule
(如果使用它),HttpModule
(如果使用的话)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)