Mastering Angular Reactive Forms
US$ 19.95
The publisher has enabled DRM protection, which means that you need to use the BookFusion iOS, Android or Web app to read this eBook. This eBook cannot be used outside of the BookFusion platform.
Description
Contents
Reviews
Language
English
ISBN
9789391030247
Cover Page
Title Page
Copyright Page
Dedication Page
About the Author
About the Reviewer
Acknowledgement
Preface
Errata
Table of Contents
1. Getting Started with Reactive Forms
Introduction
Structure
Objective
What are Reactive Forms?
Why use Reactive Forms?
Understanding the Building Blocks
Working with FormControl
The FormControl class
Working with FormGroup
The formControlName directive
Nested FormGroup
The formGroupName directive
Using FormArray in a FormGroup
Adding controls dynamically in FormArray
Removing controls dynamically from FormArray
FormGroup Actions
The Create page
The Update page
The Form Model
The Form Builder
FormGroup with FormControls
FormArray with FormControl
Conclusion
Key terms
Questions
2. HTML Form Binding
Introduction
Structure
Objective
What is an HTML binding?
Binding Using Vanilla JavaScript
Binding using Angular Semantics
Binding using Reactive Forms
Data bind radio buttons
With [formControl] directive
With [formControlName] directive
Set default values
Data bind Checkbox
With [formControl] directive
With formControlName directive
Set default values
Data bind select element
Use case with predefined options with values
Set default values
Use case with predefined options without values
Set default values
Use case with string array Options
Set default values
Use case with object array Options
Set default values
Conclusion
Key terms
Questions
3. Built-in Validators
Introduction
Structure
Objective
Why use validators?
The validity in the controls
The built-in validators
FormControl Validators
FormGroup Validators
Accessing a FormGroup's controls
FormArray validators
Accessing a FormArray's controls
Using the AbstractControl properties in controls
The updateOn option
The AbstractControl properties and the CSS
Conclusion
Key terms
Questions
4. Custom Validators
Introduction
Structure
Objective
The structure of custom validators
The ValidationErrors - key
The ValidationErrors - value
FormControl custom validators
Writing the FormControl validator
Using the FormControl validator
Informing the user of an invalid FormControl validator
FormGroup custom validators
Writing the FormGroup Validator
Using the FormGroup validator
Informing the user of an invalid FormGroup validator
FormArray custom validators
Writing the FormArray validator
Using the FormArray validator
Informing the user of an invalid FormArray Validator
The structure of custom async validators
FormControl custom async validators
Writing the async validator
Using the async validator
Informing the user of an invalid async validator
Conclusion
Key terms
Questions
5. Interact with Control's Value and Status
Structure
Objective
Understanding the Observer Pattern
Handling the input changes in real-time
Using valueChanges in FormControl
Using valueChanges in FormGroup
Using valueChanges in FormArray
Handling the input statuses in real-time
Using the statusChanges property
Adding/Removing validators dynamically
Conclusion
Key terms
Questions
6. Unit Testing
Introduction
Structure
Objective
Why unit testing
The toolset
Understanding the Jasmine framework
Understanding the Karma runner
How to conduct unit testing
Learning the AAA pattern
Unit Testing a FormGroup
Using Test Doubles
Conclusion
Key terms
Questions
7. Split and Reuse a Form
Introduction
Structure
Objective
The FormGroupDirective
Splitting the form using FormGroupDirective
Basic Info child component
Address child component
The ControlValueAccessor
Creating a custom control with ControlValueAccessor
Reusing Form Model with ControlValueAccessor
Basic Info child component
Conclusion
Key terms
Questions
Index
The book hasn't received reviews yet.