I am new in Angular 8. I am sending data to API and I have converted date format in dd/MMM/yyyy.
but i want to setValue in my FormGroup. I am getting normal date format as per system assigning me.
submitForm(data)
{
this.submitted = true;
var convertDate = this.datePipe.transform(this.premiumForm.get(‘stringval6’).value,”dd-MMM-yyyy”);
this.premiumForm.get(‘stringval6’).setValue(convertDate, {
onlyself: true
});
this.premiumService.addPremiumPost(data).subscribe((response)=>{
console.log( “get the data from response”+response);
})
}
Hello Bharat,
You can set value in angular like:-
this.premiumForm.setValue({
formControlName1: myValue1,
formControlName2: myValue2
});