Skip to content

Instantly share code, notes, and snippets.

@jakub-g
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakub-g/d56c26b02eef32eeb7c9 to your computer and use it in GitHub Desktop.
Save jakub-g/d56c26b02eef32eeb7c9 to your computer and use it in GitHub Desktop.
AT: Replacing object in data model
{
"name": "AT: Replacing object in data model",
"description": "",
"data": {
"myContainer": {
"myData": {
"a": 0,
"b": 0,
"c": 0
}
}
}
}
{macro main()}
<button {on click "updateModel" /}>Update</button>
<br>
{section {
macro: "printText",
bindRefreshTo : [{
inside: this.data,
to: 'myContainer'
}]
}/}
{/macro}
{macro printText()}
Magic value is: {@aria:Text {
bind : {
text : {
inside: this.data.myContainer.myData,
to: "b"
}
}
}/}
{/macro}
({
$classpath:'InstantTemplateScript',
$prototype : {
updateModel: function() {
var newData = {
a: 1,
b: 2,
c: 3
}
this.$json.setValue(this.data.myContainer, "myData", newData);
}
}
})
@jakub-g
Copy link
Author

jakub-g commented Oct 17, 2014

Created by Instant Aria Templates, viewable on http://instant.ariatemplates.com/jakub-g/d56c26b02eef32eeb7c9

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