This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from sjmiles/sample-tweaks
use nameChanged not keyup for input value, format for wrapping
- Loading branch information
Showing
1 changed file
with
12 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
<element name="tk-binding-to-elements"> | ||
<template> | ||
<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> | ||
<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> | ||
<label for="ageInput">Age:</label> | ||
<input id="ageInput" type="range" value="{{age}}"> | ||
<label for="nameInput">Name:</label> | ||
<input id="nameInput" value="{{name}}" on-keyup="processName" placeholder="Your name here..."> | ||
<input id="nameInput" value="{{name}}" placeholder="Your name here..."> | ||
</template> | ||
<script> | ||
Toolkit.register(this, { | ||
ready: function() { | ||
// Ready to go. | ||
}, | ||
age: "25", | ||
name: "Daniel", | ||
color: "red", | ||
owner: "Eric", | ||
processName: function(e) { | ||
// Do something. | ||
}, | ||
nameChanged: function() { | ||
if (this.name) { | ||
// ensure capitilization | ||
this.name = this.name[0].toUpperCase() + this.name.slice(1); | ||
} | ||
} | ||
}); | ||
</script> | ||
</element> | ||
</element> |