Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit a268049

Browse files
author
Scott J. Miles
committed
use nameChanged not keyup for input value, format for wrapping
1 parent 04b308e commit a268049

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
<element name="tk-binding-to-elements">
22
<template>
3-
<p>This is <strong>{{owner}}</strong>'s tk-element but <strong>{{name}}</strong> lets me borrow it. He likes the color <span style="color: {{color}}">{{color}}</span>. I am <strong>{{age}}</strong> years old.</p>
3+
<p>This is <strong>{{owner}}</strong>'s tk-element but
4+
<strong>{{name}}</strong> lets me borrow it.
5+
He likes the color <span style="color: {{color}}">{{color}}</span>.
6+
I am <strong>{{age}}</strong> years old.</p>
47
<label for="ageInput">Age:</label>
58
<input id="ageInput" type="range" value="{{age}}">
69
<label for="nameInput">Name:</label>
7-
<input id="nameInput" value="{{name}}" on-keyup="processName" placeholder="Your name here...">
10+
<input id="nameInput" value="{{name}}" placeholder="Your name here...">
811
</template>
912
<script>
1013
Toolkit.register(this, {
11-
ready: function() {
12-
// Ready to go.
13-
},
1414
age: "25",
1515
name: "Daniel",
1616
color: "red",
1717
owner: "Eric",
18-
processName: function(e) {
19-
// Do something.
20-
},
18+
nameChanged: function() {
19+
if (this.name) {
20+
// ensure capitilization
21+
this.name = this.name[0].toUpperCase() + this.name.slice(1);
22+
}
23+
}
2124
});
2225
</script>
23-
</element>
26+
</element>

0 commit comments

Comments
 (0)