Skip to content

Instantly share code, notes, and snippets.

@molcik
Last active September 20, 2017 08:21
Show Gist options
  • Save molcik/28075ab7884178909e889d86d62a434c to your computer and use it in GitHub Desktop.
Save molcik/28075ab7884178909e889d86d62a434c to your computer and use it in GitHub Desktop.
hero-detail.component.ts
...
@Component({
selector: 'hero-detail',
templateUrl: './hero-detail.component.html'
})
export class HeroDetailComponent implements OnChanges {
heroForm: FormGroup;
...
constructor(
private fb: FormBuilder,
this.createForm();
...
}
createForm() {
this.heroForm = this.fb.group({
name: new FormControl("", [
Validators.required,
Validators.minLength(4)
]),
power: '',
sidekick: ''
});
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment