Hello ,
i was trying to read a value by ionic storage and post it to data base by hhtp post but it seems thatit’s posted empty to the database …
any thing i am missing?
import { Component } from '@angular/core';
import { NavController , ToastController, App, ActionSheetController} from 'ionic-angular';
import { ReclamationPage} from '../reclamation/reclamation';
import { Http, Headers, RequestOptions } from '@angular/http';
import { PostProvider } from '../../providers/post-provider';
import { GetProvider } from '../../providers/get/get';
import { Storage } from '@ionic/storage';
import 'rxjs/add/operator/map';
import { Observable } from 'rxjs/Observable';
@Component({
selector: 'page-suivre-reclamation',
templateUrl: 'suivre-reclamation.html',
})
export class SuivreReclamationPage {
items: any;
public dt: any;
cin: string ="";
rec_id: string ="";
type_rec: string ="";
description: string ="";
adresse: string="";
laptitude: any;
longitude: any;
etat_rec: string ="";
datetime: string=""
gouvernorat: string ="";
commune: string="";
cin_admin: string=""
postal: string="";
fichiers: string="";
myphoto:any;
constructor(public navCtrl: NavController, private postPvdr: PostProvider, public http: Http,
public storage: Storage , public toastCtrl: ToastController, appCtrl: App,
public actionSheetCtrl: ActionSheetController ){
this.storage.get('session_storage').then((result) => {
this.dt = result;
this.cin = this.dt[0].cin;
console.log(this.cin + 'here');
});
this.load(this.cin);
console.log(this.cin + ' here 2');
}
//evenement d'entrée
ionViewWillEnter()
{
console.log('ionViewWillEnter SettingsPage');
}
load(cin_: string)
{
let body = {
cin: cin_ ,
aksi: 'suivre_reclamation'
}
console.log(body);
this.postPvdr.postData(body) .subscribe(data => {
this.items= data.items;
console.log(data.items);
});
}
onSuivre()
{
this.navCtrl.push(ReclamationPage);
}
}
the result :