Im working on angular 2 final release.
I have declared two modules: main app and one for the settings page.
If you want to use the pipe in a different module, then add the module where the pipe is declared to imports: [...]
of the module where you want to re-use the pipe, instead of adding it to declarations: []
of multiple modules.
For example:
@NgModule({
imports: [],
declarations: [JsonStringifyPipe],
exports: [JsonStringifyPipe]
})
export class JsonStringifyModule { }
@NgModule({
imports: [
BrowserModule, HttpModule, routing, FormsModule, SettingsModule,
JsonStringifyModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
@NgModule({
imports: [
CommonModule, HttpModule, FormsModule, routing,
JsonStringifyModule],
declarations: [SettingsComponent],
exports: [SettingsComponent],
providers: []
})
export class SettingsModule { }