I am wondering, is it possible to pass an $index param into the ng-transclude? I am trying to focus into the textarea by clicking on the elements in the ng-transclude, triggering a function inside the controller that sees the textarea, but I can't get the right ID.
<div
ng-repeat="locale in $ctrl.enabled">
<table>
<tbody>
<tr>
<td flex layout="row" layout-align="start end">
<ng-transclude
ng-transclude-slot="theExtraMenu">
</ng-transclude>
</td>
</tr>
<tr>
<td>
<md-input-container
md-no-float="true">
<textarea id="{{'textarea'+$index}}">
</textarea>
</md-input-container>
</td>
</tr>
</tbody>
</table>
</div>
So in the end, I created a parent component that has the locale as an input and transcludes all of the necessary content. Then I require the controller of said component and that's how I see the value of locale.
The reason I didn't go with the scope parent access was that if the hierarchy of the scope changed, it got broken.
Thanks @georgeawg for inspiration.
EDIT: example -
The parent component (translated-textarea-menu)
And then in the transcluded component (the extra menu component)
And access it with
this.translatedTextareaMenu.localeDirectives can
requirethe controllers of other directives to enable communication between each other. This can be achieved in a component by providing an object mapping for therequireproperty. The object keys specify the property names under which the required controllers (object values) will be bound to the requiring component's controller.For more information, see
AngularJS Developer Guide - Intercomponent Communication
AngularJS Comprehensive Directive API Reference - require