I'm trying to make a shared component for file upload to reuse it whenever needed. If I place my file upload code in same html of the form, the validation works. If i make that as separate component the validation isn't working.
Note: I want to use validation for file in some components and don't want to validation in other components
Here is working stackblitz of the code which I have tried
<form [formGroup]="formLocation" (ngSubmit)="onSubmitFarmLocation()">
<div class="form-row">
<div class="form-group col-sm-4">
<label>Property Identification Number</label>
<input class="form-control" type="text" formControlName="propertyIdentificationNumber"
[class.invalid]="!formLocation.controls['propertyIdentificationNumber'].valid && formLocation.controls['propertyIdentificationNumber'].touched " >
<div
*ngIf="!formLocation.controls['propertyIdentificationNumber'].valid && (formLocation.controls['propertyIdentificationNumber'].touched || isSubmitted)">
<div class="invalid-feedback" style="display: block;">Please enter property identification
Number
</div>
</div>
</div>
<hr>
<app-sharedfile></app-sharedfile>
<div class="form-row">
<div class=" ml-auto pb-3">
<button type="submit" class="btn btn-primary" >Submit</button>
</div>
</div>
</div>
</form>