Last active
March 27, 2017 21:04
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class CheckedValueValueConverter { | |
toView(value, trueValue) { | |
return value === trueValue; | |
} | |
fromView(value, trueValue, falseValue) { | |
return value ? trueValue : falseValue | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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