I've a form with a custom file upload component. Dependent on server data I may need multiple components on the same page.
I'm struggling to get the validation working. I.E. the "isInvalid" function within the custom form component.
get isInvalid(): boolean {
const formEl = this.form.get('inputFile');
if (!formEl) {
return true;
}
return formEl.touched && formEl.invalid;
}
This cant be some kind of unsolved problem but I've asked a few people in my network and we couldn't figure out how to get it working. Can anyone suggest either a better approach to making this work or some changes to my code please?
I've included a stackblitz to demonstrate the problem: which is that my custom component validation seems to have no idea who/where it is in relation to the form. What's interesting is that I can delete/add files to the form itself without problem.