I am trying to use the debounce binding behavior in the checkbox list, but it doesn't seem to work as I expect (I'm not sure if you can even clear the checkbox):
<label repeat.for="v of values"> <input type="checkbox" value.bind="v" checked.bind="checkedVal & debounce:1000"> Checkbox value "${v}" </label>
clicking on any of the checkedVal will immediately update the checkedVal array, whereas it works as I expect for regular input:
<input type="text" value.bind="textVal & debounce:1000"/>
Can I uncheck the box?
Here's the full code, with GistRun here . app.html :
<template> <h1>Checkbox bind debounce</h1> <form> <label for="text">text input with debounce:1000 </label> <input type="text" value.bind="textVal & debounce:1000"/> <div repeat.for="v of values"> <br/> <label> <input type="checkbox" value.bind="v" checked.bind="checkedVal & debounce:1000"> Checkbox value "${v}" </label> </div> </form> <br/> <p>Text value: ${textVal}</p> <p>Checked values:</p> <p repeat.for="v of checkedVal">${v}</p> </template>
app.js :
export class App { values = [1, 2, 3]; checkedVal = []; }
Thanks!
source share