Polymer - HTML Imports
After playing with polymer some hours, I decided to create a simple webpage format, something like, “my resume online” so, I start a skeleton, I’m not using paper elements this time, instead I created a simple menu, so, I imported the core-menu component, after that, I was struggling a little bit on how to import an external HTML, of course I can use the ajax way, but, this time, I want it to use just HTML, after some tests, finally I found the way to import an HTML:
<link rel="import" href="/internals/current.html" id="currentIm">
and then, the code to pull the DOM element that I want and add it to the document is:
var linkCurrent = document.getElementById('currentIm'); contentCurrent = linkCurrent.import.querySelector('#current'); main.appendChild(document.importNode(contentCurrent,true));
Of course, this approach is going to load the external HTML at start, and this is not going to read dynamically the information, so this is only a first cool approach
Here’s how the page looks now:
and you can check the code in Github here
















