ngOnInit() { this.registerForm = this.formBuilder.group({ firstName: [], lastName: [], }); }
<form [formGroup]="registerForm" (ngSubmit)="onSubmit()"> <div class="row"> <div class="col-md-4"> <mat-form-field class="example-full-width"> <input formControlName="firstName" matInput placeholder="Fist Name" type="text"> </mat-form-field> </div> <div class="col-md-4"> <mat-form-field class="example-full-width"> <input formControlName="lastName" matInput placeholder="Last Name" type="text"> </mat-form-field> </div> </div> <button mat-raised-button type="submit" class="btn btn-danger pull-right">Register</button> <div class="clearfix"></div> </form>
imports: [ BrowserModule, CommonModule, BrowserAnimationsModule, HttpModule, ComponentsModule, RouterModule, AppRoutingModule, MatButtonModule, MatFormFieldModule, MatInputModule, MatRippleModule, HttpClientModule, ReactiveFormsModule,
FormsModule, ReactiveFormsModule
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)