kliukovking
kliukovking

Reputation: 590

Angularjs ng-repeat stylization depending on previous value

Having some data(objects in massive inside main massive. Data looks like

masses=[
[
  {param1:150, param2:20, param3:"one"},
  {param1:150, param2:21, param3:"one"},
  {param1:150, param2:22, param3:"one"},
  {param1:150, param2:23, param3:"one"},
  {param1:100, param2:24, param3:"one"}
],
[
  {param1:100, param2:26, param3:"one"}
],
[
  {param1:100, param2:26, param3:"two"},
  {param1:150, param2:26, param3:"two"},
  {param1:100, param2:26, param3:"three"}
]

];

enter image description here

Is that any simple way to make view looks like this

enter image description here

So, if in previous object the same property has the same value, this will displays with, for example, opacity:0,4;?

https://plnkr.co/edit/g73tRszeVmxfGDbpbDEv

Upvotes: 0

Views: 24

Answers (1)

Francisco Goldenstein
Francisco Goldenstein

Reputation: 13767

When you build your model, flag the objects that have that condition. Then, while looping over the objects in the ng-repeat, use ng-class to apply specific CSS classes.

ng-class: https://docs.angularjs.org/api/ng/directive/ngClass

Upvotes: 2

Related Questions