angular add formgroup to formgroup
this.myForm = this.fb.group({
name: ['', [Validators.required]],
contacts: this.fb.group({
email: ['', [Validators.email]],
})
});
<form [formGroup]="myForm" (ngSubmit)="onSubmit()">
<mat-grid-list cols="2" rowHeight="85px">
<!-- name -->
<mat-grid-tile>
<mat-form-field>
<input matInput type="text" formControlName="name">
<mat-error *ngIf="form.controls.name.hasError('required')">Name required</mat-error>
</mat-form-field>
</mat-grid-tile>
<!-- contacts -->
<div formGroupName="contacts">
<!-- email -->
<mat-grid-tile>
<mat-form-field>
<input matInput type="text" formControlName="email">
<mat-error *ngIf="form.get('contacts').get('email').hasError('required')">Email required</mat-error>
</mat-form-field>
</mat-grid-tile>
</div>
</form>
</mat-grid-list>
Also in JavaScript:
- javascript open url
- browser detect javascript
- howt to convert 2020-02-01T08:54:07.284Z to date in javascript react
- aliexpress affiliate
- node js async delay
- cubic root javascript
- how to initialize events in fullcalendar through json data in laravel
- how to do database transactions with strapi
- how to check for duplicate syntax in javascript
- min array javascript
- javascript alert program
- string includes in js
- jquery get value of td by class
- rest parameter javascript
- get erquest jquery
- discord js channel connect
- Setting a background Image With React Inline Styles
- node stdin read char by char
- how do i check if JQuery checkbox is checked
- react repeat
- random numbers javascript
- loopback user password setter overwrite
- json datetime
- You need to inject a global window.jQuery first.