我正在使用cli构建一个角度4应用程序。我创建了一个共享模块,并在我的appmodule和moviemodule中导入了该模块。我收到编译时错误未捕获错误:模块'SharedModule'导出的意外值'undefined'
有人能告诉我问题是什么,我仔细检查了语法。我在这里遗漏了什么
错误消息
共享模块
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 { }
答案 0 :(得分:7)
删除CommonModule
exports: [
remove this => , CommonModule
, FormsModule
, GridModule
]
答案 1 :(得分:0)