Last active
August 14, 2018 18:12
-
-
Save nirlanka/9a0e67fa05e6d65599f00c8581a54ade 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
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms'; | |
// Component code: | |
addFriendForm: FormGroup; | |
private _user = { | |
name: 'Amarabandu Rupasingha', | |
email: '[email protected]', | |
}; | |
userFormItems = { | |
name: new FormControl(this._user.name, [Validators.required]), | |
email: new FormControl(this._user.email, [Validators.required]) | |
}; | |
constructor(formBuilder: FormBuilder) { | |
this.addFriendForm = formBuilder.group(this.userFormItems); | |
} | |
send = () => console.log(this.addFriendForm.value); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment