Angular Architecture & Modules Quiz – 20 Questions with Answers
20 questions · 15 min · Medium
Test your knowledge of Angular Reactive Forms and Template-Driven Forms, including form creation, validation, form controls, form groups, data binding, submission, and error handling.
No sign-up needed · Last updated:
Score: 0 00:00
Create a free account to keep your scores and track your progress. It is optional.
20 questions · 15 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
B. Reactive Forms and Template-Driven Forms
Angular provides Reactive Forms and Template-Driven Forms as its two main approaches to building and managing forms.
C. ReactiveFormsModule
ReactiveFormsModule provides directives and utilities for building reactive forms. In standalone Angular applications, it can be imported into a component's imports.
A. FormsModule
FormsModule provides directives such as ngModel and ngForm used in Template-Driven Forms.
B. FormControl
FormControl tracks the value, validation status, and interaction state of an individual form control.
A. FormGroup
FormGroup groups related FormControl instances and manages their combined value and validation status.
C. ngModel
The ngModel directive supports data binding between a form control and a component property.
B. formGroup
The formGroup directive binds a form element in the template to a FormGroup instance defined in the component.
A. formControlName
The formControlName directive associates a template input with a named control in its parent FormGroup.
B. In the component class
Reactive Forms define the form model explicitly in TypeScript, making form structure and validation logic easier to manage programmatically.
A. In the HTML template
Template-Driven Forms rely primarily on template directives and HTML attributes to define form controls and validation.
A. Validators.required
Validators.required checks that a control contains a non-empty value according to Angular's required-validator rules.
B. invalid
The invalid property is true when the control's validation status is INVALID.
A. setValue()
The setValue() method updates a FormControl's value programmatically and normally triggers value and validity updates.
A. ngSubmit
The ngSubmit event is used to handle form submissions and works with Angular's form directives.
C. They provide explicit, programmatic control over the form model
Reactive Forms define controls and validation in TypeScript, supporting predictable updates, complex validation, and straightforward unit testing.