Skip to content

Instantly share code, notes, and snippets.

@bbachi
Created February 11, 2019 16:12
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 bbachi/1cc09e4113b3446efdf41ec6414cba63 to your computer and use it in GitHub Desktop.
Save bbachi/1cc09e4113b3446efdf41ec6414cba63 to your computer and use it in GitHub Desktop.
New way of using Http in Angular
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [
AppComponent
],
imports: [
HttpClientModule,
],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule { }
import { HttpClient } from '@angular/common/http';
@Injectable()
export class AppService implements OnInit {
constructor(private http: HttpClient) {}
ngOnInit(){
this.appConfig = this.http.get(this.configUrl);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment