Using Angular 10 I want to query a sibling element. Essentially I have something like this:
<label myDirective for="foo" ...
<input id="foo" formControlName="xyz" ...
In myDirective
I can easily get the value of for
via a @HostBinding
. In my directive I then want to get the formControlName
of the element with the given ID. I'm not sure how to do that because it seems like my directive might run before the input element has been created, for example.
I'm trying to automate a bit so I don't have to write this:
<label [myDirective]="foo.attributes.getNamedItem('formControlName').value" ...
<html #foo ...