UNPKG

can

Version:

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

42 lines (35 loc) 845 B
<div id="demo"> <div id='out'></div> <script type='text/stache' id="attending-template"> <p>Attending? <select {($value)}='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> DEMO_HTML = document.getElementById("demo").innerHTML </script> <script src="../../../node_modules/steal/steal.js" main="@empty"></script> <script> steal("can/view/bindings", "can/view/stache", function(){ var person = new can.Map({ // attending: "no" }); var frag = can.view( "attending-template", person, { attendence: function(){ return person.attr("attending") ? "are a " + person.attr("attending") : "have not responded"; } }); $("#out").html( frag ); }); </script>