5.0.0 • Published 7 years ago

ulises-ionic-native-http-connection-backend v5.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

A solution to CORS problem of Ionic and WKWebView

travis build version MIT License

Motivation

Even though there is a way to solve CORS issue without changing server's response header by using Cordova HTTP plugin, the problem is it works only on device and doesn't provide all the power of Angular's Http and HttpClient services.

This project's been born as a solution to CORS problem allowing to use Angular's Http and HttpClient services in both environments: browser and device.

Installation

npm install --save @ionic-native/http ionic-native-http-connection-backend
ionic cordova plugin add cordova-plugin-advanced-http

Usage

Add NativeHttpModule and NativeHttpFallback into the application's module

import { NgModule } from '@angular/core';
import { HttpBackend, HttpXhrBackend } from '@angular/common/http';
import { NativeHttpModule, NativeHttpBackend, NativeHttpFallback } from 'ionic-native-http-connection-backend';
import { Platform } from 'ionic-angular';

@NgModule({
    declarations: [],
    imports: [
        NativeHttpModule
    ],
    bootstrap: [],
    entryComponents: [],
    providers: [
        {provide: HttpBackend, useClass: NativeHttpFallback, deps: [Platform, NativeHttpBackend, HttpXhrBackend]},
    ],
})
export class AppModule {
}

Angular < 4.3

DEPRECATED.md

Contributing

Contributing guidelines could be found in CONTRIBUTING.md

Troubleshooting

TROUBLESHOOTING.md

5.0.0

7 years ago

4.0.7

7 years ago