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

how to split array as per fixed length, and ionic two dates differences in min,seconds,hours

How to Add Firebase Analytics to Your NativeScript Mobile App