Last active
May 12, 2018 21:04
-
-
Save realtomaszkula/2d0f8da428c30a460b582cc11f8a59d6 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 { Component, OnInit } from '@angular/core'; | |
import { FormBuilder, FormGroup } from '@angular/forms'; | |
@Component({ | |
selector: 'app-suggested-username', | |
template: ` | |
<form [formGroup]="form"> | |
<input formControlName="firstName" placeholder="First name" /> | |
<input formControlName="lastName" placeholder="Last name" /> | |
<input formControlName="username" placeholder="Username" /> | |
</form> | |
`, | |
styleUrls: ['./suggested-username.component.css'] | |
}) | |
export class SuggestedUsernameComponent implements OnInit { | |
form: FormGroup; | |
constructor(private fb: FormBuilder) {} | |
ngOnInit() { | |
this.form = this.fb.group({ | |
firstName: '', | |
lastName: '', | |
username: '' | |
}); | |
this.reactiveUsername(); | |
} | |
reactiveUsername() { | |
// continue reading to see the implementation | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment