OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 8 Code distributed by Google as part of the polymer project is also |
| 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 |
| 14 <meta charset="utf-8"> |
| 15 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 16 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1, user-scalable=yes"> |
| 17 |
| 18 <title>iron-input demo</title> |
| 19 |
| 20 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 21 |
| 22 <link rel="import" href="../iron-input.html"> |
| 23 |
| 24 <link rel="stylesheet" href="../../paper-styles/demo.css"> |
| 25 |
| 26 </head> |
| 27 <body> |
| 28 |
| 29 <template is="x-autobind"> |
| 30 |
| 31 <section> |
| 32 |
| 33 <p> |
| 34 <input is="iron-input" bind-value="{{bindValue}}" value="{{value::input}
}"> |
| 35 <br> |
| 36 bind to <code>bind-value</code>: <span>[[bindValue]]</span> |
| 37 <br> |
| 38 bind to <code>value::input</code>: <span>{{value}}</span> |
| 39 </p> |
| 40 |
| 41 <p on-click="setValue"> |
| 42 set bind-value to: <input> <button value="bindValue">set</button> |
| 43 <br> |
| 44 set value to: <input> <button value="value">set</button> |
| 45 </p> |
| 46 |
| 47 </section> |
| 48 |
| 49 </template> |
| 50 |
| 51 <script> |
| 52 |
| 53 var scope = document.querySelector('template[is=x-autobind]'); |
| 54 |
| 55 scope.setValue = function(event) { |
| 56 if (!(event.target instanceof HTMLButtonElement)) { |
| 57 return; |
| 58 } |
| 59 document.querySelector('input[is=iron-input]')[event.target.value] = event
.target.previousElementSibling.value; |
| 60 } |
| 61 </script> |
| 62 |
| 63 </body> |
OLD | NEW |