【发布时间】:2016-12-06 13:00:18
【问题描述】:
在 Ionic 框架中使用 AngularJS。 在前端,$scope 包含
-
一个包含运动列表的对象用户:
$scope.user = { sports: { "running": true, "football": true } }
-
一个名为“matches”的列表,其中包含一个用户列表,每个用户都有运动项目。示例:
matches = { userA: {..., sports: {"running": true, "football": true} }, 用户B:{...,运动:{“橄榄球”:真,“足球”:真} }
在前端:
<ion-item class="item-thumbnail-left" ng-repeat="match in matches track by match.user.uid">
<img>
<span>{{match.user.firstname}} {{match.user.lastname}}</span>
<h3>{{match.user.position}} - {{match.user.lob}}</h3>
<h3>@{{match.company}}</h3>
<h4>{{match.score}} sport(s): </h4>
<h4 ng-repeat="sport in match.user.sports track by sport.id" style="float: left;">
{{sport.name}}
</h4>
</ion-item>
我想突出显示 $scope.user 与每个 $scope.matches.user 的共同运动(例如,让我们将运动涂成红色)。
你建议我怎么做?
谢谢
【问题讨论】:
标签: javascript angularjs