Skip to content
No description, website, or topics provided.
TypeScript JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.github
.vscode
lib
.gitignore
.npmignore
.prettierrc
.travis.yml
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE.md
README.md
angular.json
fake-test.js
karma.conf.js
ng-package.json
ng-package.prod.json
package-lock.json
package.json
prevent-direct-publish.js
test.ts
tsconfig.json
tsconfig.lib.json
tsconfig.spec.json
tslint.json

README.md

Angular Http service

This is an implementation of the IHttpService that can be used instead of the default http service available in Core package that uses axios package.

This library uses Angular's HttpClient to make http requests and can be used only in Angular applications.

Why and when should you use this library?

If you need to use server side rendering with prerender using Angular universal, you have to use Angular's built-in Http service because otherwise Angular will not wait until the requests are fetched from server and therefore your code would not be reflected in HTML of your page. You can find more information about the issue here

Example

First, you need to import AngularHttpServiceModule module into your AppModule (or other module depending on your architecture) and then you can inject AngularHttpService just as you are used to in Angular.

import { AngularHttpServiceModule } from 'kentico-kontent-angular-http-service';

@NgModule({
  imports: [
    AngularHttpServiceModule,
    // other imports
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

and example taken from a component:

  private readonly deliveryClient: IDeliveryClient;

  constructor(angularHttpService: AngularHttpService) {
    this.deliveryClient = new DeliveryClient({
      projectId: 'da5abe9f-fdad-4168-97cd-b3464be2ccb9',
      httpService: angularHttpService
    });
  }
You can’t perform that action at this time.