Angular Forms Interview Questions
1. What are the two types of forms in Angular?
Answer:
- Template-driven forms: Use Angular directives in HTML.
- Reactive forms: Use FormControl and FormGroup in TypeScript.
Reactive Form Sample:
this.loginForm = this.fb.group({
username: ["", Validators.required],
password: ["", Validators.required],
});