I understand that create a custom attribute on a custom element in Polymer allows us to watch for changes to that attribute by specifying a listener. But if I just need to expose a data from my custom element when do I use data attribute and when to use a Polymer's custom attribute?

I also understand that data- takes only strings

有帮助吗?

解决方案

I think you'll pretty much always want to use Polymer's custom attributes unless your attribute has the same name as a built-in attribute (like title). As you noticed, the change handlers will not work with data- attributes.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top