Hi, i have problem with collection.
I have two files .js and html view template:
html
<div id='id'></div>
</template>
js
CalendarViewController = CustomController.extend({
controller: 'CalendarViewController',
template: 'calendar.view',
menu: 'menu-calendar',
onRender: function() {
Meteor.subscribe("AllHolidays");
CalendarHelper.test();
},
helpers: {
},
events: {
},
autoFormHooks: {
}
});
js
CalendarHelper = {
test:function(){
console.log (HolidaysCollection.findOne());
return false;
},
};
When i call CalendarHelper.test from secound js file in first js file it doesnt work, it cant find enything and in web console i get “undefined”. But when i write event in first js file
events: {
'click': function(){
CalendarHelper.test();
}
},
Then it works!
I dont understand it!
Could someone say me why it happens?