Can I refuse to enter a flag in Aurelia?

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!

+5
source share
1 answer

It is currently not supported. The debounce binding behavior determines the speed at which the checkedVal property is checkedVal . In a binding check, no property is assigned; an instance of the array referenced by the property is mutated using push and splice , which bypasses debouncing in the binding expression.

+4
source

Source: https://habr.com/ru/post/1264053/


All Articles