ionic project creation



ionic start myApp tabs 
ionic generate page contact
for services ::: ionic generate provider
httpclientModule in ionic3
https://www.npmjs.com/package/ngx-http-client https://www.tutorialspoint.com/ionic/ionic_camera.htm import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import {
toPromise
} from 'rxjs/operator/toPromise';
import { AlertController, MenuController, ToastController } from 'ionic-angular';
/*
Generated class for the CallsProvider provider.

See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class CallsProvider {
SERVER_IP="http://209.126.98.38/EverestHome/public/api/v1/"
constructor(public http: HttpClient) {
console.log('Hello CallsProvider Provider');
}
post(api: string , requestData: any) {
debugger;
console.log(requestData);
return this.http.post(this.SERVER_IP + api, requestData,
{}).toPromise();
}
get(api: string) {
return this.http.get(this.SERVER_IP + api,
{}).toPromise();
}

}


service call::
this.callsProvider.post('saveImage', {
userid: this.uId,
})
.then((res: any) => {
console.log(res);
});

Comments

Popular posts from this blog

Your app currently targets API level 27 and must target at least API level 28 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 28

how to install nativescripts required tools and softwares.