I am not able to send Date

QuestionsCategory: Angular JsI am not able to send Date
Bharat Siddhe asked 8 months ago

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);
    })
   }

anuj kumar replied 8 months ago

Hello Bharat,

You can set value in angular like:-

this.premiumForm.setValue({
formControlName1: myValue1,
formControlName2: myValue2
});

1 Answers
Anuj answered 8 months ago

You can set value in angular like:-
this.premiumForm.setValue({
formControlName1: myValue1,
formControlName2: myValue2
});

 

Your Answer

Related Posts

Begin typing your search above and press enter to search. Press ESC to cancel.

Back To Top