Here is a code snippet that I am working with:
<md-input-container class="new-paragraph addon-menu">
<label>Post text</label>
<textarea ng-model="user.post" rows="3"></textarea>
</md-input-container>
<md-menu>
<md-button aria-label="" class="md-icon-button" ng-click="$mdOpenMenu($event)">
<i class="fa fa-plus-square-o mobile-menu-ic light-gray-text font-size-extra-large"></i>
</md-button>
<md-menu-content>
<md-menu-item ng-repeat="templateVariable in templateVariables">
<md-button ng-click="injectVariableAtCursor(templateVariable);">{{templateVariable}}</md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
I would like to add predefined text (at cursor position) to the user.post
model when a user clicks on a specific item within the <md-menu-content>
.
I understand that using directives with isolated scope could be beneficial, but I am unsure how to go about implementing this since the input and buttons are not directly related under a single ngModel
.
Any ideas or suggestions?