curt curt - 3 months ago 16
Dart Question

Assigning a variable value to a paper-item

I'm trying to assign a object id to a list item so that I can look it up when it's selected. There is an example here that uses a literal. It also works for me. This code doesn't set the value:

<paper-dropdown-menu label="Style">
<paper-listbox class="dropdown-content" attr-for-selected="value" selected="2">
<paper-item *ngFor="let style of styles" value="{{ style.id }}">
{{ style.name }}
</paper-item>
</paper-listbox>
</paper-dropdown-menu>


If I code
value="1"
or
value="test"
, it appears when I inspect in the browser. If it's set as above, nothing appears, not even an empty value. I've also tried creating String
test=1;
in the Angular component and using
value="{{ test }}"
. It also does not appear.

Answer

If this doesn't work, then it might be a timing issue:

attr.value="{{style.id}}"