import { CommonModule } from '@angular/common' ; import { NgModule , Optional , SkipSelf } from '@angular/core' ; @ NgModule ( { declarations : [ ] , imports : [ CommonModule ] , exports : [ ] , } ) export class CoreModule { constructor ( @ Optional ( ) @ SkipSelf ( ) presentInParent ) { if ( presentInParent ) { throw new Error ( 'CoreModule is already loaded. Import only in AppModule' ) ; } } }