How to judge wheather two variable equal in spacebar?

here ‘index’ is different on each loop

{{#each proposedVideosList}}
<a href="#" onclick="Session.set('videoNum',{{index}})">     
     <li class="{{#if {{index}}==Session.get('videoNum') }}    // 'index' is changing on each loop,how to judge if index //equal to 'videoNum' ? 
</a >

Hi, you can try this package.

it works. thank you…

1 Like

Yes handlebar-helpers works but perhaps your own helper may be simpler, something like

<li class="{{#if videoNumEquals index  }}    // 'index' is changing
videoNumEquals: function(index) {
  return Session.get('videoNum') == index;

Me, I use a general comparison helper:

Template.registerHelper 'equals', (a,b) ->
	if a==b then true


{{#if equals helper1 helper2}}