Sitemap
Feb 26, 2025

nice post

liked the used of nonNullable: true and the use of @let email = form.controls.email;

but...

in the example, you wrote:

name: new FormControl<string>('', {

nonNullable: true

}),

"...Ok that’s it, this field is now required far as Angular is concerned."

This setting alone will not make the field required

FormControl<string>('', { nonNullable: true }) allows an empty string ('') as a valid value. If you want to treat an empty string as invalid, you need to explicitly add Validators.required:

e.g.

name: new FormControl<string>('', {

nonNullable: true,

validators: [Validators.required]

})

I

--

--