javascript - How do I dynamically set the checked property on a checkbox in Aurelia based on condition -


i have list of objects using create menu checkboxes. want set checked property on these checkboxes on load basing off of enum value object model has.

here example of tried:

<li repeat.for="item of items">     <input type="checkbox" checked="${item.status == 'enumvalue' ? 'checked' : '' /> </li> 

this did not work. can give me nudge in right direction?

thanks!

you can use checked.bind="<expression>" syntax bind boolean expressions properties. [documentation]

in case: <input type="checkbox" checked.bind="item.status == 'enumvalue'" />

gist demo: https://gist.run/?id=b9a2929bdd34061795b90ddbfd745e75


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -