0

我有两个 CSS 分类triangletriangleo

<div class="triangle" ng-repeat="chatdata in chats">
<p>{{chatdata.msg}}</p>
<p> {{chatdata.time}}</p>
</div>

所以如果 chatdata.usrId == 123 类应该是triangleelsetriangleo

4

1 回答 1

3

你可以简单地使用ng-class

<div ng-class="chatdata.usrId === 123 ? 'triangle' : 'triangleo'" ng-repeat="chatdata in chats">
   <p>{{chatdata.msg}}</p>
   <p> {{chatdata.time}}</p>
</div>
于 2017-09-13T07:13:21.460 回答