Skip to content
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

Template level event binding doesn't work with meteor-jade? #113

Open
neoromantic opened this issue Jan 25, 2016 · 4 comments
Open

Template level event binding doesn't work with meteor-jade? #113

neoromantic opened this issue Jan 25, 2016 · 4 comments

Comments

@neoromantic
Copy link

I'm using mquandalle:jade package to have '.jade' templates in my projects.

When I'm trying to bind events within template, as you recommend to do, it fails.

For example:

component.jade:

template(name="MyComponent")
  button(onClick=clickHappened)

component.coffee

class MyComponent extends BlazeComponent
   clickHappened: -> 1

When component renders, I get an error:

Error: Event handler not a function: 1

What happens, as far as I understand is that jade compiler executes 'clickHappened' method instead of passing it as an argument.

Is there any way (syntax?) to use Jade with BlazeComponents?

@mitar
Copy link
Member

mitar commented Jan 25, 2016

Yes, this is something @mquandalle should add to his compiler. Here is code for HTML files.

@ciclopes
Copy link

As far as it needs a function, have you tried clickHappened: -> -> 1?
It may be a little bit ugly workaround, but it should work.

@comerc
Copy link
Contributor

comerc commented Apr 26, 2016

Hmm, blaze-magic-events works fine.

@mitar
Copy link
Member

mitar commented Apr 26, 2016

Because magic events seems to renders event handlers to DOM to define events. This is much uglier approach.

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

No branches or pull requests

4 participants