Skip to content

Slots able to pass individual values

Compare
Choose a tag to compare
@justinbmeyer justinbmeyer released this 10 Aug 02:42
· 124 commits to master since this release

Fixes #292

count:from="count" works below:

can.Component.extend({
    tag: "my-counter",
    view: `
        <can-slot name="incrementButton"
            add:from="add">
            <button on:click="add(1)">+1</button>
        </can-slot>
        <can-slot name="countDisplay"
            count:from="count">
            {{count}}
        </can-slot>
    `,
    ViewModel: {
        count: {type: "number", default: 0},
        add(increment){
					debugger;
            this.count += increment;
        }
    }
});