So i've been trying to add a PolymerElement dynamically to an other PolymerElement.
MyPolyElem newRow = new MyPolyElem();
(newRow as MyPolyElem).type = type; // -> Exception
panelBody.append(newRow);
Exception: Uncaught Error: type 'HtmlElement' is not a subtype of type 'MyPolyElem ' in type cast.
If I try to access type, it says that newRow is a HtmlElement and does not have "type". If I try to cast it, is says that its not a subtype of HtmlElement.
@CustomTag('poly-elem')
class MyPolyElem extends PolymerElement {
@published String type = "int";
void attached() {
super.attached();
}
factory MyPolyElem() => document.createElement("poly-elem");
MyPolyElem.created() : super.created() {}
}
Apparently, if i create a Polymer Element dynamically, its a HtmlElement. If i would write in the the HTML as tag and query for it, its a MyPolyElem. So i'd like to know how i could register the Name of the Class for this Tag.