Issue
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.
Solution
If this doesn’t work, then it might be a timing issue:
attr.value="{{style.id}}"
Answered By – Günter Zöchbauer
Answer Checked By – Candace Johnson (FlutterFixes Volunteer)