meteoric / meteor-ionic

Ionic components for Meteor. No Angular!
http://meteoric.github.io
MIT License
1.51k stars 219 forks source link

ionTab unable to retrieve badge count variable from helper #336

Closed lucnat closed 8 years ago

lucnat commented 8 years ago

This was asked before here and here, yet it was never solved. Let me state the problem again:

{{#ionTabs style="ios" class="has-badge"}}
    {{> ionTab title="Notifications" path="notifications" badgeNumber="{{badgeCount}}" iconOn="ios-bell" iconOff="ios-bell-outline" class="tab-item-positive notificationstab" }}
{{/ionTabs}}

gives me

Alt Text

Therefore, I cannot access the helper variable {{badgeCount}} there. And yes, the helper does exist.

fishdude commented 8 years ago

+1 on this.

daveeel commented 8 years ago

You have to make 'badgeCount' a template helper function name which returns the number. Attribute value like {{badgeCount}} won't expanded

That means ... badgeNumber=badgeCount

lucnat commented 8 years ago

Oh...my bad. It works now, thanks!

chansdad commented 6 years ago

This still is an issue .. I am just not able to get this to work ..

screen shot 2018-01-26 at 3 14 37 am

I have the main template tabs and in that

<template name="tabs">
    {{#ionTabs style="ios" class="has-badge"}}
{{> ionTab title="alerts" path="useralerts" badgeNumber="{{useralertcount}}" iconOff="android-notifications-off" iconOn="android-notifications" class="tab-item-positive"}}

    {{/ionTabs}}
</template>

and i made the helper function useralertcount as

Template.tabs.helpers({
 'useralertcount': function () {
        return Useralerts.find({}).count();
    }
});

why is it that i am seeing the curly's and not hte actual badge count? Appreciate the help.