传递参数到Dart Polymer元素 [英] Pass parameters to Dart Polymer element

查看:91
本文介绍了传递参数到Dart Polymer元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆