Handling Angular Forms Without Losing Your Sanity
summary
Compares template-driven vs reactive forms and shows concrete fixes: use FormBuilder, FormGroup/FormControl/FormArray for nested and dynamic fields, call setValidators + updateValueAndValidity when toggling required and use {emitEvent:false} on setValue/patchValue to avoid feedback loops. Demonstrates subscribing to valueChanges and using the async pipe, implements a typeahead by wrapping a third-party ngModel component with a control value accessor, uses markAllAsTouched (Angular 8) for submit handling, and ships a working Drag Race demo repo.
AI-written summary · about
chapters (50)
- 0:00Intro
- 1:10About Me
- 1:35Kansas City
- 1:56Introduction
- 2:26Angular Forms
- 4:14Reactive Programming
- 5:24Imperative vs Reactive Programming
- 7:03Key Concepts
- 8:24Operators
- 8:59Demo
- 10:16Reactive Forms
- 13:15Form Control
- 13:35Form Group
- 14:11Form Control Name
- 15:36Form Builder
- 16:38Dynamic Required Fields
- 18:09Demo Code
- 18:25Demo App
- 19:39Dry Race
- 20:06Form Controls
- 20:18Subscribe to Value Changes
- 20:49Using the SetValidators method
- 21:48Clearing out validators
- 22:10Update Value Validity
- 23:18Set Value Method
- 24:20Validation
- 25:17Handling Invalid Forms
- 25:58Handling Touched Forms
- 27:10Custom Validation Rules
- 28:05Pattern Validation
- 28:50Function Validation
- 29:48Interface
- 32:54Validation Logic
- 33:22Example Problem
- 33:43Index Bootstrap
- 34:26Setup Code
- 34:52Change Events
- 35:24Template
- 36:25Form
- 38:45FormBuilder syntax
- 40:12Insert method
- 40:53Remove method
- 41:11Form nest
- 41:50Accessing multiple insert instances
- 42:10Injecting the control container
- 43:51tics tips and tricks
- 44:56Initializing form controls
- 45:11Summary
- 46:00Demo Codes
- 46:15Questions
related talks
28mHandling Angular Forms Without Losing Your Sanity
21mComparing Angular Forms
43mAngular Reactive Forms - Developing Forms and Validation with Angular
35mLet's Build a Form Around It
19mLightning Talks - Angular2+ Reactive Forms
46mAngular's Reactive Forms
20mLet’s Build A Form Around It
47mReactive forms in Angular
