Reactive forms are more powerful and are recommended for complex forms. They use the FormControl and FormGroup classes.
import { ReactiveFormsModule } from '@angular/forms';
form = new FormGroup({
username: new FormControl(''),
email: new FormControl('')
});
constructor(private fb: FormBuilder) {}
form = this.fb.group({
username: ['', Validators.required],
email: ['']
});
Username is required
Take quizzes related to this topic and see where you stand!
Start Quiz Now