How i can access an element inside
dom-if condition?
That's part of my template:
<template>
...
<template is="dom-if" if="{{_displayUserLevelBadge(level)}}">
<div class="profileUserLevelContainer">
<iron-icon id="userLevelBadge" class="icon-20" icon="chat:verified-user"></iron-icon>
<span class="profileUserLevel">{{userLevelString}}</span>
</div>
</template>
...
</template>
I need to access #userLevelBadge in Javascript like that:
Look in the ready method.
Polymer({
is: 'custom-element',
properties: {
level: {
type: String,
value: null
},
userLevelString: {
type: String,
value: ''
}
},
ready: function() {
var userLevelBadge = this.$$('#userLevelBadge'); //return undefined
},
_displayUserLevelBadge: function(){
//not including my code
//Just returning true for simplicity
return true;
}
}
But it does not work. The condition is meet, and the HTML inside dom-if is displayed, but i can't access it using this.$$(selector), as specified in the Wiki.