Skip to content

Instantly share code, notes, and snippets.

@adityatyagi
Created December 11, 2019 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adityatyagi/d3f6acb5ee1d9dcdaa9964d86172f0d1 to your computer and use it in GitHub Desktop.
Save adityatyagi/d3f6acb5ee1d9dcdaa9964d86172f0d1 to your computer and use it in GitHub Desktop.
import { NgModule, SkipSelf, Optional } from "@angular/core";
import { CommonModule } from "@angular/common";
import { HttpClientModule } from "@angular/common/http";
import { ProjectLayoutComponent } from "./layouts/project-layout/project-layout.component";
import { NotFound404Component } from "./components/not-found404/not-found404.component";
import { UtilityService } from "./utilities/utility.service";
import { BaseService } from "./services/base.service";
import { EnsureModuleLoadedOnceGuard } from "./guards/ensure-module-loaded-once.guard";
import { HeaderComponent } from "./components/header/header.component";
import { FooterComponent } from "./components/footer/footer.component";
import { RouterModule } from "@angular/router";
import { ScrollToTopComponent } from "./components/scroll-to-top/scroll-to-top.component";
@NgModule({
declarations: [
ProjectLayoutComponent,
NotFound404Component,
HeaderComponent,
FooterComponent,
ScrollToTopComponent
],
imports: [CommonModule, RouterModule, HttpClientModule],
exports: [HttpClientModule],
providers: [BaseService, UtilityService]
})
export class CoreModule extends EnsureModuleLoadedOnceGuard {
// Looks for the module in the parent injector to see if it's already been loaded (only want it loaded once)
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
super(parentModule);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment