A polymer element offices-list needs to be created dynamically inside another polymer element's script as so:
<dom-module id="contacts-tag">
<template>
<iron-ajax ... on-response = "handleResponse"></iron-ajax>
</template>
<script>
Polymer({
is: "contacts-tag",
handleResponse: function(request){
var response = request.detail.response;
this.officesRegions = response.officesRegions;
this.officesCities = response.officesCities;
var dynamicEl = document.createElement("offices-list");
dynamicEl.setAttribute("regions", this.officesRegions);
dynamicEl.setAttribute("cities", this.officesCities);
document.body.appendChild(dynamicEl);
}
});
</script></dom-module>
However as soon as it reaches "document.createElement("offices-list");" the element inside this new tag starts rendering, and it's on ready method is already called, while I was expecting them to happen after I set attributes. How can I do it?
Edit: Seems that problem is of different nature. I'm setting objects to attributes and "offices-list" tag is not recognizing them, hence isn't able to access it or loop through it. Then, my question will change to, "How to bind objects?"