I'm learning Angular2, and I'm trying to check if a text field inside my component is valid or not. I built a component called MyUpload and I'm calling it inside a modal component. On my modal, I'm trying to verify if a field (myField) inside it is valid or not. I tried to do something like this:
<my-upload #upload [maxSize]="10000" [multiple]="true"></my-upload>
<textarea name="comment" ... ></textarea>
<button ...
[disabled]="f.form.valid && upload.form.myField.valid" ...>Save</button>
But I get:
Cannot read property 'myField' of undefined
I also tried upload.form.control.myField.valid, but its not working. It seems that the #upload is not referencing the form inside my component.
How can I do that?