<style>
.object_screen {
width: 800px;
height: 500px;
}
.div1 {
width: 200px;
height: 200px;
float: left;
margin-left: 10px;
}
</style>
<div class="object_screen">
<div class="div1" ng-repeat="object in objectList" ng-click="checking(object.name);" ng-style="{'background-image':'url(./img/level/{{ object.image }})}"></div>
</div>
<div class="listAnswer">
<li ng-repeat="object in objectList">{{ object.name }}</li>
</div>
这是我的角色剧本
var App = angular.module('App', ['ngRoute']);
App.controller('playController', ['$scope', '$http', function($scope, $http) {
$scope.objectList = [];
$scope.objectList.push({name:'tony', image:'image1.png'});
$scope.objectList.push({name:'Jay', image:'image2.png'});
$scope.objectList.push({name:'Michael', image:'image3.png'});
$scope.checking= function(nameObject){
// change text-decoration to underline for class listAnswer
}
}]);
答案 0 :(得分:0)
您可以在范围中声明一个变量,使其最初具有布尔值false,并在$ scope.checking中将其更改为true,并在后续行中使用ng-class div class =“listAnswer”ng-class =“{'your text decoration css class':在$ scope.checking中设置监视变量}”当变量设置为true时,将应用您的文本修饰类