I recreate an h2-element here:
<link rel="import" href="../../js/lib/polymer/polymer.html">
<dom-module id="x-custom">
<style>
h2 { color: green; }
</style>
<template>
<div id="content">
<h2>TEST</h2>
</div>
</template>
<script>
(function() {
Polymer({
is: 'x-custom',
ready: function() {
this.$.content.innerHTML = '<h2>TEST 2</h2>';
this.updateStyles();
}
});
})();
</script>
</dom-module>
If I skip the ready-function "TEST" is green, but not "TEST 2". Thought updateStyles()
may fix this, but didn't. Any ideas why this doesn't work? (Polymer 1.0, Chrome 44)
How about of binding data?
You can't use innerHTML as usual, you need to do this with Polymers own DOM API. This works: