Skip to content

Instantly share code, notes, and snippets.

@LayZeeDK
Last active December 30, 2018 23:47
Show Gist options
  • Save LayZeeDK/db6691bf81ea9026fef47639aad2d9de to your computer and use it in GitHub Desktop.
Save LayZeeDK/db6691bf81ea9026fef47639aad2d9de to your computer and use it in GitHub Desktop.
Pre-Angular 6 singleton service
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { PreSixModule } from './pre-six.module.ts';
@NgModule({
imports: [
HttpClientModule,
PreSixModule,
],
})
export class CoreModule {}
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
@Injectable()
export class PreSixSingletonService {
constructor(
private http: HttpClient,
) {}
}
import { NgModule } from '@angular/core';
import { PreSixSingletonService } from './pre-six-singleton.service';
@NgModule({
providers: [
PreSixSingletonService,
],
})
export class PreSixModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment