Tom
Tom

Reputation: 8681

Error: Unexpected value 'undefined' exported by the module

I am building an angular 4 application using cli . I have created a shared module and importing that module in my appmodule and moviemodule. I am getting a compile time error Uncaught Error: Unexpected value 'undefined' exported by the module 'SharedModule'

Could somebody tell me what the problem is I double checked the syntax. Am I missing something here

Error message

enter image description here

shared module

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

App module

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

Movie module

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

Upvotes: 11

Views: 9650

Answers (2)

yurzui
yurzui

Reputation: 214077

Remove comma front of CommonModule

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

Upvotes: 11

Vinay Prabhakaran
Vinay Prabhakaran

Reputation: 773

  1. Please try removing the Grid Module from the exports in the SharedModule. The foreach in the error may be coming out of the grid module, i am assuming the grid module is trying to loop through some data.
  2. There is an extra comma in the exports section before first module listed

Upvotes: 0

Related Questions