can
Version:
MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.
22 lines (20 loc) • 573 B
HTML
<body>
<script src="../../node_modules/steal/steal.js" main="@empty" id="data-source">
import Component from "can/component/";
import stache from "can/view/stache/";
can.Component.extend({
tag: "hello-world",
template: stache("{{#if visible}}{{message}}{{else}}Click me{{/if}}"),
viewModel: {
visible: false,
message: "Hello There!"
},
events: {
click: function(){
this.viewModel.attr("visible", !this.viewModel.attr("visible") );
}
}
});
$("body").append(stache("<hello-world/>")({}));
</script>
</body>