gpt4 book ai didi

angular - 错误 : Unexpected value 'undefined' exported by the module

转载 作者:太空狗 更新时间:2023-10-29 17:07:11 26 4
gpt4 key购买 nike

我正在使用 cli 构建一个 angular 4 应用程序。我创建了一个共享模块并将该模块导入到我的 appmodule 和 moviemodule 中。我收到编译时错误 Uncaught Error: Unexpected value 'undefined' exported by the module 'SharedModule'

谁能告诉我问题出在哪里我仔细检查了语法。我在这里遗漏了什么吗

错误信息

enter image description here

共享模块

import { NgModule }            from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { GridModule } from '@progress/kendo-angular-grid';


@NgModule({
imports: [ CommonModule
, GridModule ],

exports: [
, CommonModule
, FormsModule
, GridModule
]
})
export class SharedModule { }

应用模块

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {FormsModule} from '@angular/forms';
import {HttpModule} from '@angular/http'
import { AppComponent } from './app.component';
import { NavbarComponent } from './navbar/navbar.component';
import { TopbarComponent } from './topbar/topbar.component';
import { FooterbarComponent } from './footerbar/footerbar.component';
import { MRDBGlobalConstants } from './shared/mrdb.global.constants';
import {AppRoutingModule} from './app.routing';
import {HomeComponent} from './home/home.component';
import {MovieComponent} from './movie/movie.component';
import { MRDBCommonService } from './shared/services/mrdb.common.service';
import { NotFoundComponent } from './not-found/not-found.component';
import { SharedModule } from './shared/shared.module';


@NgModule({
declarations: [
AppComponent,
FooterbarComponent,
TopbarComponent,
NavbarComponent,
MovieComponent,
HomeComponent,
NotFoundComponent
],
imports: [
BrowserModule,
HttpModule,
SharedModule,
AppRoutingModule
],
providers: [MRDBGlobalConstants,
MRDBCommonService],
bootstrap: [AppComponent]
})
export class AppModule { }

电影模块

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {MovieComponent} from './movie.component';
import { SharedModule } from '../shared/shared.module';

@NgModule({
imports: [
SharedModule
],
exports: [MovieComponent],
declarations: [MovieComponent]
})
export class MovieModule { }

最佳答案

移除 CommonModule 前面的逗号

exports: [ 
remove this => , CommonModule
, FormsModule
, GridModule
]

关于angular - 错误 : Unexpected value 'undefined' exported by the module,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44873369/

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