import { Component } from '@angular/core' ; import { FormBuilder , FormGroup , FormGroupDirective , Validators } from '@angular/forms' ; @ Component ( { selector : 'demo-solution' , templateUrl : './solution.component.html' , styleUrls : [ './solution.component.scss' ] } ) export class SolutionComponent { form : FormGroup ; introSnippet = 'solution.intro.snippet.html' ; snippet = 'solution.snippet.html' ; constructor ( fb ) { this . form = fb . group ( { email : [ '' , [ Validators . required , Validators . email ] ] , age : [ null , [ Validators . required , Validators . min ( 18 ) ] ] } ) ; } submit ( ) { } reset ( f ) { f . resetForm ( { email : '' , age : null } ) ; } }