Dart Polymer唯一可以找到的实例不使用任何参数。如何将参数传递给模板。是通过构造函数完成的吗?
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 specific example is that I have a card element with a title, and I want to pass the title of the card as a string to the element.
我看过将数据传递给Polymer元素
但这不完全是我想要做的。我想从dart代码中传递数据。
but this is not exactly what I want to do. I want to pass data from within dart code.
推荐答案元素的构造函数从Polymer调用,没有办法传递
The constructor of elements is called from Polymer and there is no way to pass parameters.
您可以像@Vloz所写,在元素创建后分配值,或者您可以使用绑定,如链接的问题(将数据传递到Polymer元素)使用绑定。
You can as @Vloz wrote, assign values after the element was created or you can use binding as in the question you linked (Passing data to a Polymer element) using bindings.
更多推荐
传递参数到Dart Polymer元素
发布评论