Last active
August 5, 2018 12:42
-
-
Save nirlanka/fb5fa321625f66fcc1508c9fb49f897f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form [formGroup]="addFriendForm" (ngSubmit)="onSubmit()"> | |
<input type="text" formControlName="name"> | |
<input type="text" formControlName="email"> | |
<button type="submit" | |
[disabled]="!f.valid">Submit!</button> | |
</form> | |
// Component | |
public addFriendForm: FormGroup; | |
constructor(formBuilder: FormBuilder) { | |
this.addFriendForm = formBuilder.group({ | |
name: [user.name, Validators.required], | |
email: [user.email, Validators.required] | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment