UNPKG

can

Version:

MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.

32 lines (28 loc) 719 B
<div id="demo"> <div id='out'></div> <script type='text/stache' id="demo-html"> <p>Attending? <select value:bind='attending'> <option value='yes'>Yes</option> <option value='no'>No</option> <option value='maybe'>Maybe</option> </select> </p> <p>You {{ attendence() }}.</p> </script> </div> <script src="../../node_modules/steal/steal.js" dev-bundle main="@empty"> import { DefineMap, stache, stacheConverters } from "can"; var person = new DefineMap({ attending: "no" }); var template = stache.from("demo-html"); var fragment = template(person, { attendence: function(){ return person.attending ? "are a " + person.attending : "have not responded"; } }); out.appendChild(fragment); </script>