ulises-ionic-native-http-connection-backend
v5.0.0
Published
A solution to CORS problem with Ionic and WKWebView
Downloads
111
Maintainers
Readme
A solution to CORS problem of Ionic and WKWebView
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
Contributing
Contributing guidelines could be found in CONTRIBUTING.md