New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can-event trows an error when inside #if block #1182

Closed
whitecolor opened this Issue Jul 29, 2014 · 0 comments

Comments

Projects
None yet
2 participants
@whitecolor
Contributor

whitecolor commented Jul 29, 2014

Was trying to wrap can-click handler in `if`` block but failed

<button {{#if handleClick}}can-click="clickHandler"{{/if}}>Click</button>

trowas an eror if handleClick is false, and works normal if handleClick is true

http://jsfiddle.net/xKc3H/438/

can.Component({

    tag: 'my-comp',

    scope: {
        handleClick: false,
        clickHandler: function(){
            alert('clicked')
        }
    },        

    template: '<button {{#if handleClick}}can-click="clickHandler"{{/if}}>Click</button>'

})

$('body').append(can.view.mustache('<my-comp/>')())

Should it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment