JeffGillin
JeffGillin

Reputation: 37

Custom html attribute in dom-repeat template in Polymer 0.9

I'm trying to bind a field inside a dom-repeat template in polymer 0.9 to an custom attribute of a div tag. In other words, just some random attribute I made up (which seems to work fine in other circumstances), but the attribute never ends up getting added to the div (if I view in Inspect Element, my attribute isn't there).

example:

<div vendor-id="{{item.vendorId}}">

If I inspect the div, the 'vendor-id' attribute isn't there. If I bind the same thing to the 'id' attribute of the div, it binds perfectly fine. I can't use id though in my scenario because I have multiple of these divs within the same row. I'm storing the primary key for edit / delete functionality for a crud interface. Anyways, I'm sure I can work around this, but really want to ensure I understand why this custom attribute isnt getting added to the DOM. Any thoughts?

Upvotes: 1

Views: 468

Answers (1)

Nicholas Brandt
Nicholas Brandt

Reputation: 374

I ran into the same problem.

You can use the $= assignment.

<div any$="{{binding}}"></div>

It is stated in the Polymer docs.

I hope that answers your question.

Upvotes: 3

Related Questions