UrlResolverModule
This allow define configuration of objects request
Using HttpModule in an Ionic 2 app
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
// import url-resolver module
import { UrlResolverModule } from '@stefanini/url-resolver';
export const APP_ROUTE = {
'_defaults': {
'host': 'http://api.example.com/'
},
'user': {
'url': 'users/{id}',
'method': 'GET',
'headers': {
'content-type': 'application/json'
},
'params': {
'id': {
'type': 'number',
'required': true
}
}
}
};
@NgModule({
declarations: [
MyApp
],
imports: [
IonicModule.forRoot(MyApp),
UrlResolverModule.initialize(APP_ROUTE),
],
bootstrap: [IonicApp],
entryComponents: [
MyApp
]
})
export class AppModule {}