kumaran
kumaran

Reputation: 61

How to use OR condition in rivetsJS

How to use OR condition in rivetsJS while binding it in html dom. The below code does not work for me while using rivets. It works when i use a single condition

<div rv-class-highlight="view.year || view.month">
</div>

Upvotes: 0

Views: 839

Answers (1)

kdaimiel
kdaimiel

Reputation: 21

I have been using a formatter

rivets.formatters.or = function(value, args) {
  return value || args;
};

And then

<div rv-class-highlight="view.year | or view.month">
</div>

Upvotes: 2

Related Questions