SharedModule contains code that will be used across your app and Feature Modules. You’ll import this SharedModule into the specific Feature Modules as needed. You DO NOT import the SharedModule into your main AppModule.

Creating a ‘SharedModule’ is part of the Angular Style Guide: Style 04-10. Create a feature module named SharedModule in a shared folder; for example, app/shared/shared.module.ts.

import { NgModule } from '@angular/core';

import { SearchPipe } from '../pipes';
import { SafeUrlPipe } from '../pipes';

@NgModule({
  imports: [],
  declarations: [
    SearchPipe,
    SafeUrlPipe
  ],
  providers: [],
  exports: [
    SearchPipe,
    SafeUrlPipe
  ]
})
export class SharedModule { }

And import it on Feature module to use it, for example:

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';

import { ContactDetailsPage } from './contact-details';
import { SharedModule } from '../../shared/shared.module';

@NgModule({
  declarations: [
    ContactDetailsPage,
  ],
  imports: [
    SharedModule,
    IonicPageModule.forChild(ContactDetailsPage),
  ],
})
export class ContactDetailsPageModule {}

SharedModule includes components, directives, and pipes that you use everywhere in your app. This module should consist entirely of declarations, most of them exported.

Furthermore


Victor Dias

Sharing mobile Experiences

Follow me