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

Meteor package #67

Closed
jiku opened this issue May 8, 2015 · 2 comments
Closed

Meteor package #67

jiku opened this issue May 8, 2015 · 2 comments

Comments

@jiku
Copy link

jiku commented May 8, 2015

Can't seem to make it work in Meteor, by itself or by including any of the widely used Bootstrap packages

bootstrap

mizzao:bootstrap-3

twbs:bootstrap

Maybe it's a load order issue, but I can't get it to work locally either. No console errors that I can see, either on Meteorpad or when going to the instance URLs. (Using latest Chrome.)

@abpetkov
Copy link
Owner

I managed to run it locally by itself. Here is what I did:

  • Set up a simple app with meteor create <app-name>.
  • In my main HTML file I added:
<body>
  {{> switchery}}
</body>

<template name="switchery">
  <input type="checkbox" class="js-switch" checked />
</template>
  • In my main JS file I added:
if (Meteor.isClient) {
  Template.switchery.rendered = function() {
    var elem = this.find('.js-switch');
    var init = new Switchery(elem);
  };
}

And that was enough. I'm assuming you have something wrong with your code in this case. Still, I'd better have @mediatainment have a word on this, as he was the one that initiated the creation of the Switchery Meteor package (PR #54) and I'm not an expert when it comes to Meteor.

@jiku
Copy link
Author

jiku commented May 15, 2015

Thanks! Then it was just a matter of not using templates it seems. With onRendered it's working here with events, etc.

/client/app.js

Template.switchery.onRendered(function () {
  var elem = this.find('.js-switch');
  var init = new Switchery(elem);
});

Template.switchery.events({
  "change .js-switch": function (event) {
    console.log("Works");
  }
});

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

No branches or pull requests

2 participants