Angular Reactive Forms

https://www.pluralsight.com/courses/angular-reactive-forms

by Jim Cooper


Mod 1: Course Overview

  1. Course Overview

Mod 2: Getting Started with Angular Reactive Forms

  1. Introduction
  2. Angular Forms Architecture Overview
  3. Template Driven vs. Reactive Forms
  4. Cloning and Exploring Our Demo Application
    • demo of InMemoryDbService
      • will intercept http calls and return mock data

Mod 3: Creating Angular Reactive Forms
  1. Introduction
    • shows how to import ReactiveFormsModule
  2. Adding Reactive Forms to a Project
  3. Creating Form Controls
  4. The Magic of the ControlVa lueAccessor Directive
  5. Providing Values to FormControls
  6. Creating FormGroups
    • you use formControl directive when you don't have a form group
    • if you have a formgGroup, you use the formControlName directive
  7. Submitting a Reactive Form
    • use case for Partial in typescript
  8. Saving Submitted Form Data
  9. Adding Unbound FormControls to a FormGroup
    • shows how to have a form element that is not visible (is it hidden input?) huh
  10. Creating Nested FormGroups
    • use case for getRawValue on a formgroup
    • use formGroupName directive for a nested formgroup
  11. Simplifying with FormBuilder and FormGroup.setValue()
    • formBuilder simplifies the creation of a form group 
    • You can use this.fb.nonNullable to make all form fields non nullable
      • you can override to make a field null
    • if the shape of the formBuilder and your target object are the same, you can initialize the formBuilder with a one liner: this.contactForm.setValue(<name of your object instance>)
  12. Summary
Mod 4: Working with Input Elements and Data Types
  1. Introduction
  2. Working with Radio Buttons
    • use the same formControlName on all radios in the group
      • you don't have to set the name attribute
      • dynamically set value by doing [value]='...'
  3. Working with Select Lists
    • dynamically set value by doing [value]='...'
  4. Working with Checkboxes
  5. Working with Numeric Inputs
  6. Working with Range Inputs
  7. Working with Textarea Elements
  8. Working with Date Values
  9. Summary
Mod 5: Validating Angular Reactive Forms
  1. Introduction
  2. Angular's Built-in Validators
  3. Adding Validation to FormControls
    • when working with formbuilder, you set validators like this:
      this.fb.group({
      ...
      firstname: ['', Validators.required]
      ...
      });
  4. Displaying Validation Messages
  5. Handling Multiple Validators on a Single Field
    • use case for a getter
    • when you have a formcontrol with multiple validators, inspect the errors object to determine which validator is failing
      • *ngIf='firstName.errors?.['required']' ..."
  6. Validating FormGroups and Forms
  7. Creating Custom Validators
  8. Passing Data to and from Custom Validators
    • a custom validation is not required to returned a Boolean
    • a demo of a custom validation that returns a string instead of a Boolean
  9. Summary
Mod 6: Creating Custom Controls and ControlValueAccessors
  1. Introduction
  2. Creating a Custom DateValueAccessor
    • ControlValueAccessor as a directive on type input
    • register the directive as an ng value provider

  3. Custom DateValueAccessor: Implementing writeValue()
  4. Custom DateValueAccessor: Handling Input Events
  5. Creating Custom Input Controls
  6. Binding a Custom Component to a FormControl
    • a component as a ControlValueAccessor 
    • registerOnTouched is needed to know if the control has been touched for validation 
  7. Summary
Mod 7: Dynamically Adding Form Elements
  1. Introduction
  2. Understanding FormArrays
  3. Adding FormArrays to a Form Model
    • you bind a formArray with FormArrayName
  4. Dynamically Adding Form Elements
    • looping formgroups inside of a formarray
    • you may have to manually push all your formgorups into a formArray in ngOnInit
      • even when using setValue, you will have to push empty formgroups
  5. Summary
Mod 8: Reacting to Changes
  1. Introduction
  2. Subscribing to Value Changes
  3. Reacting to Value Changes
    • you can dynamically add a validator to a control using addValidators method
      • to remove a validator, use removeValidators method
    • use updateValueAndValidity method to notify angular to force validation check
      • use distictUntilChnaged to prevent an infinite loop
  4. Adding Reactive Transformations
    • example of how to temporarily remove a validaors and add it back
  5. Summary

Comments

Popular posts from this blog

Angular Routing and Navigation Playbook

Working with Files in C# 10

Mastering Git