I am not really sure what you are trying to achieve, but the voat API returns all the comments as an array so as you iterate over the array you can decide what is even or odd and how you want to render them. If you are using a different API it would probably return data in a similar matter where you just decide what is even or odd in the front end.
It just took me a bit of time to sink in but I managed it using itsmemom97 suggestion, it works out well, http://jsfiddle.net/m7uW7/871/. I'm a bit slow when it comes to programming, even simple explanations take a little time to understand.
5 comments
1 u/itsmemom97 26 Nov 2015 12:51
I'm not sure how voat does it, but you could use css and nth-child(even) and (odd) to achieve this.
from this link.
0 u/CatInTheHat 26 Nov 2015 14:09
This is from the submissions page but the same logic is probably used for the comments.
Here the C# code decides if something is even or odd and sets the class
And here is where they change the background colour for the item, they only need to change evens because the odds use the original background colour
0 u/Karmadilla [OP] 26 Nov 2015 20:20
This sucks. I'm completely decoupled from back end. I'm using angular without any ASP MVC. So all my calls are API calls.
0 u/CatInTheHat 26 Nov 2015 20:30
I am not really sure what you are trying to achieve, but the voat API returns all the comments as an array so as you iterate over the array you can decide what is even or odd and how you want to render them. If you are using a different API it would probably return data in a similar matter where you just decide what is even or odd in the front end.
0 u/Karmadilla [OP] 26 Nov 2015 20:56
It just took me a bit of time to sink in but I managed it using itsmemom97 suggestion, it works out well, http://jsfiddle.net/m7uW7/871/. I'm a bit slow when it comes to programming, even simple explanations take a little time to understand.