41
rated 0 times
[
43]
[
2]
/ answers: 1 / hits: 5396
/ 10 Years ago, wed, may 14, 2014, 12:00:00
Can anyone tell me how I could import an element depending on the value of a Polymer attribute?
I thought I could use data binding but... It's not working. Is it possible to import an element dynamically?
code exemple here:
<link rel=import href=app-window/{{name}}-app.html>
//This was my first idea (obviously doesn't work)
<polymer-element name=window-base attributes=name >
<template>
<link rel=stylesheet href=window-base.css>
<section id=app>
<!--here will go the instance-->
</section>
</template>
<script>
Polymer('window-base', {
name: Finder,
ready: function () {
this.instanceApp();
},
instanceApp: function () {
//this depends on the import made
var app=document.createElement(this.name + -app);
this.$.app.appendChild(app);
}
});
</script>
</polymer-element>
Thanks!
More From » polymer