I have created a directive for a textarea (TextAreaExt) and i want to call a method of that directive from a component it is used in. The selector of the directive is "textarea" (no attribute, affects all textarea elements). In my component if i do the following:
@ViewChild('TextAreaExt') txt: TextAreaExt;
I can call methods on txt successfully. But what if i had multiple textareas? I would like to do it like this instead:
@ViewChild('txt') txt: TextAreaExt;
Unfortunately, the above line does not return a TextAreaExt class, but instead returns an ElementRef.
How could i solve this problem so that i could have multiple text areas?