gpt4 book ai didi

angular - BrowserModule 已经加载

转载 作者:行者123 更新时间:2023-12-01 19:44:53 29 4
gpt4 key购买 nike

这是我的代码:

 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 {}

我不知道为什么我会得到这个异常(exception):

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



在 future 的模块中,我导入 CommonModule而不是 BrowerModule .任何人都可以帮助我吗?

最佳答案

进口 BrowserAnimationsModuleHttpModule仅一次(在您的根模块或核心模块中)。

仅将这些提到的模块导入一次(仅在 app-module 中):
BrowserModule , BrowserAnimationsModule , LazyLoadImageModule (如果使用),CarouselModule (如果使用),InfiniteScrollModule (如果使用),HttpModule (如果使用它)

关于angular - BrowserModule 已经加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56110455/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com