I'm getting some strange behavior using Meteor.
I'm in a template helper defined in client/ . The function "percentCompleted" is a helper function defined in client/lib/helper.js. When I call "percentCompleted" in the return line, percentCompleted completes normally. However, whenever I call percentCompleted outside of the return line, the console logs an error that the function "percentCompleted" is undefined. Why would a helper function be defined or undefined depending on where in the template helper it is called??
This works:
Template.chapter.percentComplete = function(){
if(_.isEmpty(this))
return "";
return percentCompleted(this)
}
This throws an error with "percentCompleted" undefined.
Template.chapter.percentComplete = function(){
if(_.isEmpty(this))
return "";
var percentCompleted = percentCompleted(this)
return percentCompleted;
}