@arunoda thank you I found that by following [this][1] article. I just had another question if I have a block like this
<template name="ListCards">
> {{#if isSubReady 'cards'}}
> {{#each getCards}}
> {{> CreditCardNav}}
> {{> CreditCardContent}}
> {{/each}}
> {{else}}
> Loading...
> {{/if}}
> </template>
will my templates that are wrapped in the #each loop “CreditCardNav” and “CreditCardContent” and the other nested templates within those templates still have access to the ‘cards’ collection so that they can render properties or should I NOT abstract other templates outside of this particular template because then the helper of this template wouldn’t work on the nested templates?
My app isn’t throwing errors it’s just that my collection never gets pulled in but rather I get the 'Loading…" on the screen instead of the collection.
Here are my ‘ListCards’ helpers:
Template.ListCards.helpers({
isSubReady: function(sub) {
if(sub) {
return FlowRouter.subsReady(sub);
} else {
return FlowRouter.subsReady();
}
},
getCards: function() {
return Cards.find({});
}
});
Note: I have 4 records in the collection and here is the route:
// BILLING INFORMATION
FlowRouter.route('/account/billing_information', {
subscriptions: function(params, queryParams) {
this.register('cards', Meteor.subscribe('allCreditCards'));
},
action: function(params, queryParams) {
FlowLayout.render('MasterLayoutUsers' , {top: 'Header' , main: 'BillingTab' , bottom: 'Footer'});
},
name: 'billingTab' //pathFor value
});
Here is the publication within server/publications.js
Meteor.publish('allCreditCards', function(){
return Cards.find({});
});
and here is the collection lib/collections/Cards.js
Cards = new Mongo.Collection("cards");
Thank you.
[1]: http://massimilianomarini.com/flowrouter-and-flowlayout-101/