Chinmay Yogi
Chinmay Yogi

Reputation: 97

Difference between UntypedFormControl and FormControl #Angular14 #AngularMigration

I recently migrated from Angular12 to Angular14, Angular automatically converted FormControl to UntypedFormControl in some places. I observed that in some components where I am using FormControl it is still written as FormControl. So I am bit confused on which criteria or in which conditions angular converted FormControl into UntypedFormControl and why at some places it is still FormControl. I understood that UntypedFormControl is simply pointing to FormControl with type any.

When I compared both scenarios I don't see any difference in coding and the way I am creating and using formGroup and formControl. It got me more confused.

Thanks in advance!

Upvotes: 7

Views: 4111

Answers (1)

Ujjwal Rajpal
Ujjwal Rajpal

Reputation: 51

Untyped is just to minimize impact on your existing code base during the migration. It is better now to use typed form for new development. And ideally convert legacy code base to typed form also if needed.

Check the detailed description on typed forms on https://ujjwal-rajpal96.medium.com/angular-strictly-typed-vs-untyped-forms-e63cded8a228

Upvotes: 0

Related Questions