Hello Guys…
i am developing an app in ionic 3. in this i am using a <ion-datetime picker and i want to call a function onchange date but when i am click on date and select date and click on done button its called function but my model data not updated … means its take existing data model value … please help this is my code:
HTML:
Date
<ion-datetime displayFormat=“MM-DD-YYYY” formControlName=“vDATE” (ngModelChange)=“vDATE”>
In .ts file:
dt:string =’’;
paymentForm: FormGroup;
vNarration: string;
vDATE: string;
vAmount: string;
vAccountdr: string;
vAccountcr: string;
constructor(public navCtrl: NavController, public navParams: NavParams,public formBuilder: FormBuilder,public http : Http ,public loading: LoadingController)
{
this.paymentForm = formBuilder.group({
vAmount: [’’],
vDATE: [’’],
vNarration : [’’],
vAccountdr : [’’],
vAccountcr : [’’]
});
}
changedate()
{
alert(this.paymentForm.value.vDATE);
this.getvoucher(this.paymentForm.value.vDATE);
}
getvoucher(dt)
{
alert("date "+dt);
let headers1 = new Headers();
headers1.append("Accept",'application/json');
headers1.append('content-type','application/json');
let options1 = new RequestOptions({ headers: headers1});
let postParams1 =
{
Idclient: this.clientid,
vouchertype:13,
Entrydate:dt
}
}
In this code when i am select date it call changedate function but alert me old date … please help!! i am big truble