第1个回答 2017-03-28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html ng-app="test">
<head>
<title>Freetrial</title>
</head>
<body ng-controller="FreetrialController">
<div class="xsy" ng-repeat="item in freetrial" ng-if="use('xy0001', 0, item)" id="xy0001">
<a href="{{item.sdcx()}}"><img src="">{{item.imgurl}}</a>
<h1>{{item.goodstitle}} </h1>
</div>
<script type="text/javascript" src="../lib/angular.min.js"></script>
<script>
var app = angular.module('test', []);
app.controller('FreetrialController', function($scope){
$scope.use = function(id, status, item){
var flag = false;
if(!item || (id === item.goodsid && status === item.status)){
flag = true;
}
return flag;
}
$scope.freetrial = [
{
goodsid:"xy0001",
imgurl:"img/178.jpg",
goodstitle:"好娃娃牌安全椅",
quantity:"10份",
cost:896,
linkt:"sdcx()",
status:0
},
{
goodsid:"xy0002",
imgurl:"img/178.jpg",
goodstitle:"时尚包",
quantity:"10份",
cost:298,
status:1
},
{
goodsid:"xy0003",
imgurl:"img/178.jpg",
goodstitle:"好娃娃",
quantity:"10份",
cost:896,
linkt:"sdcx()",
status:0
}
]
});
</script>
</body>
</html>
<!--还可以从数据上着手, 先把数据按照需求重组,再输出到视图-->本回答被提问者采纳