You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, Angular form controls when you call .reset will revert to null. So since the control could be reset, the controls will include null.
Starting in Angular 14, there is now 3 ways you can prevent this
The closest to your way, new FormControl<ESyncOrderBy>(ESyncOrderBy.Name, { nonNullable: true })
Using an instance of FormBuilder, like fb = inject(FormBuilder) you can do this.fb.nonNullable.control(...)
Using an instance of NonNullableFormBuilder, like fb = inject(NonNullableFormBuilder) you can do this.fb.control(...).
This can be done on individual controls, so that should be sufficient for your use case. One thing to note: this cannot be done to a whole FormGroup instance, but you can make each control inside of it non-nullable.
Hi, why vscode says that "orderBy" can be null?
The text was updated successfully, but these errors were encountered: