Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Aria Templates common mistakes: not using $json.setValue
"name": "Aria Templates common mistakes: not using $json.setValue",
"description": "When you forget to use setValue for updating the data model entry, none of defined data binding refreshes will occur",
"data": {
"counter": 0
{macro main()}
<button {on click "updateModelBad" /}>Update counter</button>
<button {on click "updateModelBetter" /}>Update counter (better)</button>
Counter has value of: {@aria:Text {
text :,
bind : {
text : {
to: "counter"
$prototype : {
updateModelBad: function() {
// just updates the value in data model
// won't trigger all the updates defined through data binding;
alert("counter is " +;
updateModelBetter: function() {
// better, this will trigger all the refreshes
this.$json.setValue(, "counter", + 1);
alert("counter is " +;

This comment has been minimized.

Copy link
Owner Author

@jakub-g jakub-g commented Oct 17, 2014

Created by Instant Aria Templates, viewable on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment