{{#if isCordova}}?


#1

Hi,

{{#if isCordova}}
  This is Cordova
{{else}}
  This is not Cordova
{{/if}}

does not identify when the user is on device. Is there another handler?

Thanks

Mike


#2

You can easily write your own global helper.

Afaik there’s something like Meteor.isCordova. So just wrap that in a global helper and you got it.


#3

Yes true, I should have thought about it.

Here is the helper for other newbies:

isCordova:  function() {

if (Meteor.isCordova) {

return true;

}

else {

return false;

}
}

Thanks!


#4

You’d be better off doing this with Template.registerHelper to have a global helper that’s accessible in every template. Also, you probably don’t need if/else, Meteor.isCordova should return either true or false by itself.

Template.registerHelper('isCordova', function () {
	return Meteor.isCordova;
});

#5

ok cool, even better. Thanks