matteodem / meteor-easy-search

Easy-to-use search for Meteor with Blaze Components
MIT License
437 stars 68 forks source link

Load More Button Attribute Bug #472

Closed ritchieng closed 8 years ago

ritchieng commented 8 years ago

Hi,

I followed the documentation but I'm unable to modify the load more button attribute.

Here's the code:

{{> EasySearch.Loadmore index=companiesIndex content="Load more" attributes={class:"btn btn-primary btn-md"} }}

There's a syntax error for attributes reported in the error log.

matteodem commented 8 years ago

Please have a look at meteor docs on how to pass JS objects in Blaze.

ritchieng commented 8 years ago

Hi @matteodem, thanks for replying.

I tried searching but I'm unable to come up with a solution. I tried this:

{{> EasySearch.Loadmore index=companiesIndex content="Load more" attributes=class}}

And

Template.templateName.helpers({
    class: "btn btn-primary btn-md"
});

But it does not work.

matteodem commented 8 years ago

Try:

{{> EasySearch.Loadmore index=companiesIndex content="Load more" attributes=attributes}} 
Template.templateName.helpers({
    attributes: function () {
      return { class: 'test' };
    } 
});

This should be pretty clear from the docs, or isn't it?

ritchieng commented 8 years ago

@matteodem Thanks for your help. I'm not adept in Meteor yet, but you're really good. Sorry for taking your time, you're really helpful though.

The newbies out there would love this snippet of code in your docs though. Thanks again!

matteodem commented 8 years ago

No problem, will add a new issue regarding this code snippet

ritchieng commented 8 years ago

@matteodem I think the code needs some tweaking. It still does not work, it's the same button without any class loaded. Seems like I'm having an "unused property attributes" warning in my code editor (Webstorm). Any idea?

matteodem commented 8 years ago

Please provide a reproduction repository or have a look at others that provided examples in other issues.

ritchieng commented 8 years ago

@matteodem I've a repo at bitbucket, do you've an email/user where I can send to you to view?