Getting null when accessing inner element from ons-template. Getting null when document.getElementById('infinite-list') is called from javascript
-
<ons-template id="home.html"> [undefined](undefined) <ons-page> <ons-toolbar> <div class="left"> <ons-toolbar-button onclick="fn.open()"> <ons-icon icon="ion-navicon, material:md-menu"></ons-icon> </ons-toolbar-button> </div> <div class="center"> Main </div> </ons-toolbar> <ons-list> <ons-lazy-repeat id="infinite-list"></ons-lazy-repeat> </ons-list> </ons-page> </ons-template>
-
@raju That’s correct. It’s the way
ons-template
works. I’d recommend using nativetemplate
element instead since it’s supported from v2.4.0 onwards.