0

I want to check a condition with or. how is it possible?

  {{#if  $.Session.equals 'showField' 'edit'}}

or

 {{#if  $.Session.equals 'showField' 'add'}}
Mehrnoosh
  • 879
  • 2
  • 12
  • 27
  • 2
    Take a look at [this SO question](http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional). I think this is what you're looking for. – blueren Apr 05 '17 at 06:32
  • 1
    consider to install this ? https://github.com/raix/Meteor-handlebar-helpers and use $or a b – iiro Apr 05 '17 at 07:01
  • both of them is correct. thank you... – Mehrnoosh Apr 05 '17 at 09:06

1 Answers1

0

As Blueren and Iiro said:

 {{#if or  ($.Session.equals 'showField' 'edit') ($.Session.equals 'showField' 'add') }}

Then in clien/helpers folder make a js file and put this:

Template.registerHelper('or',(a,b)=>{
  return a || b;
});
Mehrnoosh
  • 879
  • 2
  • 12
  • 27