I have worked with template driven forms before and I am slightly confused how the reactive forms work to store the data to my database. Initially I would just use [(ngModel)]="user.date". How do I store the data now on submit? I have built one as follows:
this.formGroup = this._formBuilder.group({
formArray: this._formBuilder.array([
this._formBuilder.group({
dateFormCtrl: ['', Validators.required]
}),
this._formBuilder.group({
emailFormCtrl: ['', Validators.email]
}),
])
});
Here's an example of an input that I want to store to the db:
<input formControlName="dateFormCtrl" matInput [matDatepicker]="picker" [max]="maxDate" [min]="minDate" placeholder="When is your event?"(click)="picker.open()" readonly>
ATM I have this function which I built for the template driven form to store data:
create() {
this.http.post('http://localhost:3000/user', this.user).subscribe(res => { ............