Get element by id from inside a modal


Hello. I’m struggling in getting an element from inside a modal scope.

This is my modal

<script id="_writtenNoteModal.html" type="text/ng-template">
        <ion-header-bar class="bar-light">
            <div class="buttons">
                <button ng-click="saveNote()" class="button button-small button-clear button-dark">Save</button>
            <h1 class="title">Written Note</h1>
            <div class="buttons">
                <button ng-click="closeWrittenNoteModal()" class="button button-small button-clear button-dark">Cancel</button>
        <ion-content class="padding">
            <div class="row">
                <div class="col">
                    <textarea id="writtenNote" placeholder="Write notes about this wine..." rows="7"></textarea>

The modal is declared to $scope.writtenNoteModal

Now I’m trying to get the element like so:


But it isn’t working. How can I get an element from inside a modal?


… ähm the modalObject is no DomElement i think… it is a ionic-modalObject

For dom manipulating things you just can use angularjs directives… there your get the $scope, the $element as jqLite object and the attributes of that dom element.


Ofcourse! How foolish of me. I have no idea why I was thinking it is a DomElement :smiley:

Thank-you for your help.