This package has been deprecated

Author message:

No longer Supported

@vendasta/vhttp

0.0.0 • Public • Published

vHttp

vHttp is a Angular2 component for making HTTP calls.

Requirements

First, you will need to include the component into your application.

npm install @vendasta/fec-icon [--save-dev]

Using vHttp requires having HTTP providers in your application (app.ts) as such:

@Component({
    ...
    directives: [
        HTTP_PROVIDERS
    ]
})

bootstrap(AppComponent, [
    HTTP_PROVIDERS
]);

Usage

The 'vHttp' service is injected into other components to allow the other components to make HTTP calls. To use it: import it, include it within your providers, and instantiate it in your constructor.

import {VHttpService} from "@vendasta/fec/vhttp/vhttp.service";

@Component({
    ...
    providers: [VHttpService],
    ...
})

export class TestComponent {
    ...
    constructor(private vHttpService: VHttpService){}
    ...
}

You can then use the vHttp service to make API calls that returns the data field of a JSON object returned by the API.

export class TestComponent {
    ...
    useVHttpService(url) {
        this.vHttpService.get(url).subscribe(
            result => this.testItems = result,
            error => this.errorMessage = <any>error;
        )
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @vendasta/vhttp

Weekly Downloads

1

Version

0.0.0

License

ISC

Last publish

Collaborators

  • vendasta