bitovi/canjs

View on GitHub
demos/can-component/hello-world.html

Summary

Maintainability
Test Coverage
<div id="demo-html">
<div id="out"></div>
<script id="app" type="text/mustache">
    <hello-world></hello-world>
</script>
</div>
<script src="../../node_modules/steal/steal.js" dev-bundle main="@empty"></script>
<script id="demo-source">
steal("can/component",function(){
    var x = 0;
can.Component.extend({
  tag: "hello-world",
  view: "{{# if(visible) }}<b>{{ message }}</b>{{ else }}<i>Click me</i>{{/ if }}",
  viewModel: {
    visible: false,
    message: "Hello There!"
  },
  events: {
    click: function(){
        this.viewModel.attr("visible", true)
    }
  }
});

$("#out").html( can.view("app",{}) )

})
</script>