html forms Flashcards

1
Q

What type of application is Angular?

A

Single-page application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the two approaches to working with forms in Angular?

A

Template-driven and reactive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the template-driven approach?

A

HTML form is created and Angular infers (deduces) the structure of the form.

It is used for more simple forms.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the Reactive Approach?

A

Structure is defined in code; form is setup in HTML and then both are manually connected; this approach
provides greater control.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What Module must be imported for Forms to work?

A

FormsModule.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the <form> tag tell Angular in template-driven approach?

A

Tells Angular to automatically create the template ONCE we register control of each field.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the reactive form approach?

A

The structure is defined in the TypeScript file (coded), Form set up done in HTML and then manually connected.

This type of approach provides greater control and is used for
larger and more complex forms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

For reactive forms to work, what is needed?

A

Imports must be included from angular/forms.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are validators?

A

A validator is a function that processes a FormControl or collection of controls and returns an error map or null. A null map means that validation has passed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the syntax for a form import?

A

Import {FormGroup, FormControl} from ‘@angular/forms’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How are validators imported?

A

import {…, Validators} from ‘@angular/forms’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly