Slide 1

Slide 1 text

Solve Complex and Dynamic Forms with Angular Session Max Marschall @MaxOSchulte Engineer / Consultant

Slide 2

Slide 2 text

Session Marschall Solve Complex and Dynamic Forms with Angular

Slide 3

Slide 3 text

Session Solve Complex and Dynamic Forms with Angular

Slide 4

Slide 4 text

Form Control “Tracks the value and valida2on status of an individual form control.” Angular’s form approach in a nutshell Session Solve Complex and Dynamic Forms with Angular Form Control (Inputs, etc.)

Slide 5

Slide 5 text

Control Value Accessor (CVA) “A base class that all FormControl-based directives extend. It binds a FormControl object to a DOM element.” Angular’s form approach in a nutshell CVA Session Solve Complex and Dynamic Forms with Angular Form Control (Inputs, Components)

Slide 6

Slide 6 text

Control Container “A base class for directives that contain multiple registered instances of NgControl. Only used by the forms module.” § NgForm / FormGroup / FormArray Angular’s form approach in a nutshell Sub Form? Session Solve Complex and Dynamic Forms with Angular Form Control (Inputs, Components) Control Container (Groupes, Arrays, Reac:ve Forms, Template Driven) Form Control (Inputs, Components) …

Slide 7

Slide 7 text

Template driven and reactive forms https://angular.io/guide/forms-overview Session Solve Complex and Dynamic Forms with Angular

Slide 8

Slide 8 text

Typed Reactive Forms changes § All controls are typed § Untyped Prefix for legacy forms § UntypedFormControl § UntypedFormGroup § UntypedFormArray § … § Inferred type from definiFon § Or explicit on definiFon § MigraFon got you covered 😊 Angular’s Reactive Forms > Ng 14 Session Solve Complex and Dynamic Forms with Angular

Slide 9

Slide 9 text

Typed Reactive Forms § NgForm / FormGroup / FormArray § + FormRecord § (Old) FormBuilder ➡ UntypedFormBuilder (Untyped) § FormBuilder (Typed) § NonNullableFormBuilder (Typed) § Resets to iniFal value Angular’s Reac=ve Forms > Ng 14 Control Container (Groupes, Arrays, Reactive Forms, Template Driven) … Session Solve Complex and Dynamic Forms with Angular Form Control (Inputs, Components) Form Control (Inputs, Components)

Slide 10

Slide 10 text

Typed Reactive Forms Angular’s Reac=ve Forms > Ng 14 Session Solve Complex and Dynamic Forms with Angular h?ps://angular.io/guide/typed-forms#formrecord

Slide 11

Slide 11 text

Requirements Max’s forms solu=on matrix § Dynamic § Extendable § Reusable § 0-N array objects § Validatable § My summary ✅ ✅ foundation ✅ ✅ ✅ “easy” ✅ ✅ ✅ ✅ ✅ “hard” Event-driven CVA Template driven Reactive Session Solve Complex and Dynamic Forms with Angular + Cross validation + Dependency injection

Slide 12

Slide 12 text

LIVE CODING Session Solve Complex and Dynamic Forms with Angular

Slide 13

Slide 13 text

Dependency injec7on § Loose connecFon § Provide config or extend § Forms across rouFng Recommended concepts Session Solve Complex and Dynamic Forms with Angular Validation § Constraints § Cross-Field dependencies § Group validation

Slide 14

Slide 14 text

Recap Form Control (Inputs, Components) Control Container (Groupes, Arrays, Reactive Forms, Template Driven) Form Control (Inputs, Components) … Session Solve Complex and Dynamic Forms with Angular CONTAINER A

Slide 15

Slide 15 text

Recap Session Solve Complex and Dynamic Forms with Angular Form Control (Inputs, Components) Control Container (Groupes, Arrays, Reac:ve Forms, Template Driven) Form Control (Inputs, Components) … CONTAINER A Form Control (Inputs, Components) Control Container (Groupes, Arrays, Reactive Forms, Template Driven) Form Control (Inputs, Components) … CONTAINER B

Slide 16

Slide 16 text

Control Container Recap § Dependency injecFon § Cross valdiaFon Session Solve Complex and Dynamic Forms with Angular Form Control (Inputs, Components) Control Container (Groupes, Arrays, Reac:ve Forms, Template Driven) Form Control (Inputs, Components) … CONTAINER A Form Control (Inputs, Components) Control Container (Groupes, Arrays, Reactive Forms, Template Driven) Form Control (Inputs, Components) … CONTAINER B

Slide 17

Slide 17 text

https://www.thinktecture.com/de/max-marschall Max Schulte @MaxOSchulte Engineer / Consultant Vielen Dank