I have tried this a couple different ways and they both behave the same way (see below for code). I\'m using a spacebars if condition (and tried using a helper as well) to check
Are you sure you're thinking about this correctly?
isUserLoggedIn: function() { // implies you're checking for the user
var user = Meteor.user(); // if there's a user this returns true
if(user) { // you're saying if there's a user ...
return false; // return false
} else{ // and if there isn't
return true; // return true
}
}
Basically you're saying "is the user logged in" and if yes "return false" which is making you double think. Instead, reverse your logic.
isUserLoggedOut: function() { // implies you're checking for the user
var user = Meteor.user(); // if there's a user this returns true
if(user) { // there is a user
return false; // so isUserLoggedOut == false
} else{ // and if there isn't a user
return true; // isUserLoggedOut == true
}
}
Now your template becomes easy
{{#if isUserLoggedOut}}
{{>loggedOutTemplate}}
{{/if}}