Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1870)

Unified Diff: sky/examples/widgets/index.sky

Issue 850383002: Add two way data binding. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Make it async. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/framework/sky-element/observe.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/widgets/index.sky
diff --git a/sky/examples/widgets/index.sky b/sky/examples/widgets/index.sky
index d4e55c0d1082b62a3a33a4acdf95a78270cd3f37..98b0ab47a4d024f4db2932851d460990c281e415 100644
--- a/sky/examples/widgets/index.sky
+++ b/sky/examples/widgets/index.sky
@@ -25,7 +25,10 @@
}
</style>
- <sky-input id="text" value="Ready" />
+ <sky-box title='Text'>
+ <sky-input id="text" value="{{ inputValue }}" />
+ <div>value = {{ inputValue }}</div>
+ </sky-box>
<sky-box title='Buttons'>
<sky-button id='button' on-click='handleClick'>Button</sky-button>
@@ -37,7 +40,8 @@
<div><sky-checkbox id='checkbox' />Checkbox</div>
<div class="output">highlight: {{ myCheckbox.highlight }}</div>
<div class="output">checked: {{ myCheckbox.checked }}</div>
- <div><sky-checkbox id='checkbox' checked='true'/>Checkbox, default checked.</div>
+ <div><sky-checkbox id='checkbox' checked='{{ checked }}'/>Checkbox, default checked.</div>
+ <div class="output">checked: {{ checked }}</div>
</sky-box>
<sky-box title='Radios'>
@@ -61,6 +65,8 @@ module.exports = class extends SkyElement {
this.myCheckbox = null;
this.myText = null;
this.clickCount = 0;
+ this.inputValue = "Ready";
+ this.checked = false;
}
attached() {
this.myButton = this.shadowRoot.getElementById('button');
@@ -70,7 +76,8 @@ module.exports = class extends SkyElement {
}
handleClick(event) {
this.clickCount++;
- this.myText.value = "Moar clicking " + this.clickCount;
+ this.checked = !this.checked;
+ this.inputValue = "Moar clicking " + this.clickCount;
}
}.register();
</script>
« no previous file with comments | « no previous file | sky/framework/sky-element/observe.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698