1.0.1 • Published 6 years ago

ionic-native-http-angular-wrapper v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Ionic Native Http Angular Wrapper

This is a basic package for wrapping the @ionic-native/http plugin@^4.3.0 with observables and providing a fallback to the @angular/http@^4.4.0 method.

This will only handle basic requests, anything more advanced you should use the packages separately.

This works with the WKWebView for iOS, and bypasses the CORS issues associated with @angular/http and WKWebView

Notes:

  • PATCH method is not available
  • Local files will have to be handled manually, use isNativeHttpAvailable() to check if nativeHttp will be used

Add native http client to Ionic project & add module

$ ionic cordova plugin add cordova-plugin-advanced-http
$ npm install ionic-native-http-angular-wrapper --save
# or yarn add ionic-native-http-angular-wrapper

Add to App Module - app.module.ts

// Import your module
import {NativeHttpWrapper} from 'ionic-native-http-angular-wrapper';
 
@NgModule({
  declarations: [
    MyApp,
    HomePage
  ],
  imports: [
    IonicModule.forRoot(MyApp),
   //Put here
   NativeHttpWrapper
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage
  ],
  providers: [
  ]
})
export class AppModule {}

Using the module

import {HttpWrapper} from "ionic-native-http-angular-wrapper";
  
constructor(private httpWrapper: HttpWrapper) {}
 
    public getStuff() {
        this.httpWrapper.get('http://google.co.uk', {},{})
    }
    
}
1.0.1

6 years ago

3.0.1

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago