How can I access the value of a property inside a function? Here is the property
<my-element name="Subrata"></my-element>
Inside <my-element>I have a function like this:
Approach No. 1
<dom-module id="my-element">
<template>
...
...
</template>
<script>
(function () {
is: 'my-element',
properties:{
name: {type: String}
},
getMyName: function(){
return this.name;
}
})();
</script>
</dom-module>
Run codeHide resultMy other approach was to put the value inside the element, but that didn't work either.
Approach # 2
<dom-module id="my-element">
<template>
<p id="maxp">{{name}}</p>
</template>
<script>
(function() {
is: 'my-element',
properties: {
name: {type: String}
},
getMyName: function(){
var maxpValue = this.$$("#maxp").innerHTML;
return maxpValue;
}
})();
</script>
</dom-module>
Run codeHide resultHow can i do this? Please, help.
Thanks in advance
source
share