Q:

Change class in angularJS in ng-repeat

I have two css classed triangle and triangleo
<div class="triangle" ng-repeat="chatdata in chats">
<p>{{chatdata.msg}}</p>
<p> {{chatdata.time}}</p>
</div>

So if chatdata.usrId == 123 class should be triangle else triangleo

A:

you can simply use ng-class
<div ng-class="chatdata.usrId === 123 ? ' triangle' : 'triangleo'" ng-repeat="chatdata in chats">
   <p>{{chatdata.msg}}</p>
   <p> {{chatdata.time}}</p>
</div>

