Some Challenges during Angular 10 to 14 Version migration
Apr 19, 2023
- requires error
<div class="row">
<div class="col-5">
<label for="email">Email *</label>
<input
type="text"
class="form-control"
formControlName="email"
id="email"
placeholder="Client email"
/>
<div
[class.d-block]="
clientForm.controls['email'] &&
clientForm.controls['email'].errors &&
clientForm.controls['email'].errors.required &&
showErrorRequired
"
class="invalid-feedback"
>
Your email is required.
</div>
</div>
</div>
For fixing it required added at bracket notation
<div class="row">
<div class="col-5">
<label for="email">Email *</label>
<input
type="text"
class="form-control"
formControlName="email"
id="email"
placeholder="Client email"
/>
<div
[class.d-block]="
clientForm.controls['email'] &&
clientForm.controls['email'].errors &&
clientForm.controls['email'].errors['required'] &&
showErrorRequired
"
class="invalid-feedback"
>
Your email is required.
</div>
</div>
</div>
2. event.target.files files doesn’t exist
problem code
<input
type="file"
#fileDropRef
multiple
id="fileDropRef"
(change)="fileBrowseHandler($any($event).target.files)"
/> untypeForms Nestesd Forms
Solution code
$any($event).target.files)
3. Type ‘AbstractControl<any, any>’ is missing the following properties from type ‘FormGroup<any>’: controls, registerControl, addControl, removeControl, and 2 more.ngtsc(2740)
solved using :
in tsconfig make Strictemplate false.