I have one angular2 component which I want to share among multiple modules.
So I wrote below sharedModule ,
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {GenericComponent} from './generic/generic.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ GenericComponent ],
exports: [ GenericComponent ]
})
export class SharedModule { }
then I added this sharedModule to multiple modules as below:
app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {SharedModule} from './shared.module';
import { AppComponent } from './app.component';
@NgModule({
imports: [ BrowserModule,SharedModule ],
declarations: [ AppComponent ],
exports: [ AppComponent ],
bootstrap: [AppComponent]
})
export class AppModule { }
I also added sharedModule to generic.module.ts similarly ,
generic.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {SharedModule} from './shared.module';
@NgModule({
imports: [ BrowserModule,SharedModule ],
declarations: [ //.. here I have added all the components that generic uses ]
})
export class GenericModule { }
but I am getting below error when I am trying to use generic component inside components of generic.module.ts
Unexpected value 'undefined' imported by the module 'GenericModule'
GenericModuleanywhere.. pls add it.Unexpected value 'undefined' imported by the module 'A'. What I'm suppose to do in this case ?