Skip to content

Instantly share code, notes, and snippets.

@singledigit
Last active March 27, 2017 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save singledigit/d3e3502994a09f10c6c8e520645d0e25 to your computer and use it in GitHub Desktop.
Save singledigit/d3e3502994a09f10c6c8e520645d0e25 to your computer and use it in GitHub Desktop.
Aurelia value-converter allowing two string values to be used as a checkbox boolean
export class CheckedValueValueConverter {
toView(value, trueValue) {
return value === trueValue;
}
fromView(value, trueValue, falseValue) {
return value ? trueValue : falseValue
}
}
<input type="checkbox" checked.bind="color | checkedValue:'Green':'Blue'" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment