How to do two-way binding using CanJS?
Enter the Text : <input type="text" name="name" can-value="enteredText" />
Display the Text: {{enteredText}}
Can show multiple approaches? Using ViewModel ?
Display the Text: {{enteredText}} Ca" /> Display the Text: {{enteredText}} Ca" /> Display the Text: {{enteredText}} Ca"/>
How to do two-way binding using CanJS?
Enter the Text : <input type="text" name="name" can-value="enteredText" />
Display the Text: {{enteredText}}
Can show multiple approaches? Using ViewModel ?
On
can-value was the old method in v2. In Canjs 4.0, you would do two way binding like this:
Enter the Text : <input type="text" name="name" value:bind="enteredText" />
Display the Text: {{enteredText}}
See: https://canjs.com/doc/can-stache-bindings.twoWay.html
Here's a jsbin demonstrating the syntax:
Please have a look here (docu for v2 and for v3).
At least if you use the (nowadays recommended) components approach you can write
This is from the documentation.