Skip to content

Instantly share code, notes, and snippets.

@Tanver-Hasan
Created July 29, 2018 10:45
Show Gist options
  • Save Tanver-Hasan/dbce0f4518fe5e789ae7a90fd5943480 to your computer and use it in GitHub Desktop.
Save Tanver-Hasan/dbce0f4518fe5e789ae7a90fd5943480 to your computer and use it in GitHub Desktop.
<mat-card>
<mat-card-content>
<form class="example-form" [formGroup]="customerForm">
<mat-form-field class="example-full-width">
<input type="text" matInput formControlName="firstName" placeholder="FirstName">
</mat-form-field>
<mat-form-field class="example-full-width">
<input type="text" matInput formControlName="lastName" placeholder="Last Name">
</mat-form-field>
<mat-card>
<button type="submit" mat-raised-button color="primary" (click)="addMobile()">
Add More Number </button>
<br>
<br>
<div formArrayName="mobiles" *ngFor="let leg of mobiles.controls; let i= index;">
<div [formGroupName]="i">
<mat-form-field class="example-full-width">
<input type="number" matInput placeholder="Mobile Number" formControlName="number">
</mat-form-field>
<button type="button" mat-raised-button color="accent" (click)="removeMobile(i)"> Remove</button>
</div>
</div>
</mat-card>
<button type="button" mat-raised-button color="primary" (click)="save()" [disabled]="!customerForm.valid">
Save</button>
</form>
</mat-card-content>
</mat-card>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment