Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.

Gorniv/ngx-transfer-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm Downloads

deprecated, use https://github.com/Gorniv/ngx-universal

ngx-transfer-http

Implementation http for Angular universal work based on TransferState

The package can be installed using:

npm install @gorniv/ngx-transfer-http --save

v1.1.2 is for use on Angular5

>v1.1.2 are for use on Angular6

TransferHttpModule

in app.module.ts

import { HttpClientModule } from '@angular/common/http';
import { TransferHttpModule, TransferHttpService } from '@gorniv/ngx-transfer-http';


@NgModule({
  imports: [
    BrowserModule.withServerTransition({ appId: 'my-app' }),
    HttpClientModule, // must have this
    TransferHttpModule
    ...

TransferHttpService

in app.module.ts

import { TransferHttpModule, TransferHttpService } from '@gorniv/ngx-transfer-http';

@NgModule({
  providers: [TransferHttpService],
  imports: [
   ...
})

use in component or service:

import { TransferHttpService } from '@gorniv/ngx-transfer-http';

...

constructor(private http: TransferHttpService){}

getData(): void{
    this.http.get<MyObjectModel>('https://reqres.in/api/users?delay=1').subscribe(result => {
      console.log(result);
      ...
    });

}

check:

  1. Node server console
  2. Open network in developer tools browser and your XHR network must be empty

network chrome