Meteor - Strange behavior when using {{#if}} to setup table rows -


I am trying to set the table using alternate row colors.

Simple to help determine whether the row number is odd or even;

  Template.drillDown.trx = function () {return trx.find ({userID: Meteor.userId ()}); } Template.drillDown.isEven = function (num) {Return! (Num & amp; 1); }  

And I have this template called Drilldown;

  & lt; Table & gt; {{#each trx}} {{#if is also trx_num}} & lt; Tr class = "even" & gt; {{Else}} & lt; Tr square = "weird" & gt; {{/ If}} & lt; Td> {{Trx_num}} & lt; / Td> & Lt; / TR & gt; {{/ Every}} & lt; / Table & gt;  

I get an unexpected error {{else}}. I have tried to set it up other ways, where I would like the entire tag like & lt; Tr class = "even" & gt; , but then it throws an error when this closing tag appears, what is the suggestion to avoid this problem?

The issue is that you are just wrapping the start tag {{# if}} In the spacebar in the block, everything should be a complete element with the beginning and end tag.

The best way to complete what you are looking for is:

Helpful:

  Template.drillDown.isEven = function () {Return! (This.trx_num & amp; 1); }  

HTML:

  & lt; Tr class = "{{# if ifEven}} also {{else}} weird {{/ if}}" & gt; & Lt; TD & gt; {{Trx_num}} & lt; / TD & gt; & Lt; / TR & gt;  

In addition, you can completely avoid this whole case and also using strange sections instead of tr: nth-child (even) Can:


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -