The only solid example I could find for Dart Polymer doesn\'t use any parameters. How can I pass parameters to the template. Is it done through the constructor?
My s
If you are creating a custom element you can use a factory constructor:
class MyElement extends HtmlElement {
int _foo;
factory MyElement(int foo) => new Element.tag('my-tag').._foo = foo;
MyElement.created() {
// Careful _foo has not been assigned yet.
}
}
main() {
document.register('my-tag', MyElement);
var element = new MyElement(42);
}
I assume this also works for PolymerElements, but I haven't tried this myself.