How to track if Angular patchValue is already finished?
At the beginning of the application, i get server data and patch it to my form. Afterwards i would like to mark my form as pristine, so i can disable the submit button until user changes something. The problem is that patching takes so much time that i cant set my form as pristine. Only with setTimeout i can accomplish that which is a terrible solution. Any ideas how could i track if the patching is over or any alternative solution ?
Thanks !
How to use updateValueAndValidity()
I have two form controls as min
and max
. At the beginning min
has a default value of 1
and max
is empty. I want that max
be always greater than min
, so I defined a custom validator, which works nicely.
Is using native events to submit forms in angular bad practice?
I’m somewhat new to angular, mostly coming over from react.
Validating nested template driven form that uses router-outlet
I have been trying to validate a template driven form, part of which comes from a router outlet.
The router outlet show different form fields depending upon the option clicked.
Typed forms, extending common controls
export interface CommonControls { selected: FormControl<boolean>; } export interface FirstFormControls extends CommonControls { name: FormControl<string>; price: FormControl<string>; } export interface SecondFormControls extends CommonControls { ordering: FormControl<number>; type: FormControl<string>; description: FormControl<string>; } export type BaseFormGroup<T extends CommonControls> = FormGroup<T>; Why can’t I extend specific controls with common controls and use them in a type? Theres an […]
How to unit test a custom ErrorStateMatcher in Angular?
I have a custom matcher, very basic, and I don’t know how to write a unit test for this (minimum coverage is mandatory on the project).