Abhishek saini
Abhishek saini

Reputation: 527

document.getElementById() not working inside uib-tab

When my DOM element is outside the uib-tab ,then it is working fine

Html:

<input type="file" id="clickMe"/>
   <uib-tab>

   </uib-tab>

angular controller :

console.log(document.getElementById('clickMe'));

And giving me the desired result.

But when i am putting my DOM element inside the uib-tab, then

Html:

<uib-tab>
    <input type="file" id="clickMe"/>
</uib-tab>

controller:

console.log(document.getElementById('clickMe'));

giving me null.

Please Help.

Upvotes: 0

Views: 727

Answers (1)

Pengyy
Pengyy

Reputation: 38171

Guess you are trying to console while page is still not rendered completely. You should try wrap it with $timeout, which equal with document.ready.

refer this plunker.

Upvotes: 1

Related Questions