AngularJS ngRepeat: how to differentiate even/odd elements? -
I am new to angular and am trying to do the following:
Lt; Tr data-ng-repeat = "elements in horrible things" & gt; & Lt; div ng- if = "$ index% 2 == 0" & gt; & Lt; Td square = "even here" & gt; & Lt; A href = "#" & gt; {{Element}} & lt; / A & gt; & Lt; / TD & gt; & Lt; / Div & gt; & Lt; div ng-if = "$ index% 2! = 0" & gt; & Lt; Td square = "weird" & gt; & Lt; A href = "#" & gt; {{Element}} & lt; / A & gt; & Lt; / TD & gt; & Lt; / Div & gt; & Lt; / TR & gt; For the above code, both ng-if is passing. Try the $ even and where I'm making a mistake
property. Like:
& lt; Tr data-ng-repeat = "elements in horrible things" & gt; & Lt; div ng-if = "$ even" & gt; & Lt; Td square = "even here" & gt; & Lt; A href = "#" & gt; {{Element}} & lt; / A & gt; & Lt; / TD & gt; & Lt; / Div & gt; & Lt; div ng-if = "$ odd" & gt; & Lt; Td square = "weird" & gt; & Lt; A href = "#" & gt; {{Element}} & lt; / A & gt; & Lt; / TD & gt; & Lt; / Div & gt; & Lt; / TR & gt;
Comments
Post a Comment