Unexpected behavior of data contexts with ifs - fixed


#1

edit: sorry for the noise, works as expected.

I have a template that uses data contexts - {{#with myObject}}

the code looks like
Template.awesome_template.myObject = function () {
return ObjectCollection.findOne({ … });
}

Within the template I’m able to print out {{object_property}}, which is turn out is true
But {{#if object_property}} won’t work.
I have to create a special helper for it.

Am I doing something wrong ?


#2

Hi, use Template Helpers:

Template.awesome_template.helpers({
     myObject : function(){
         return ObjectCollection.findOne({ .. });
     }
})