这是我的对象:
$scope.tickets = [{
title: "Bug 1",
number: 1,
desc: 'Description #1',
assigned: [{
name: "Someone",
group: "Development"
}]
},
{
title: "Bug 2",
number: 2,
desc: 'Description #1',
assigned: [{
name: "someone2",
group: "Development"
}]
},
{
title: 'Random unknown issue',
number: 3,
desc: 'Description #3',
assigned: [{
name: "Someone3",
group: "Support"
}]
}];
我正在做一个表格来显示所有内容,我在里面做一个 hg-repeat 但我不知道如何访问分配的名称和组信息
<p class="lead">Development:</p> <div class="table-responsive"> <table class="table table-striped table-condensed"> <thead> <tr> <!-- <th>index</th> --> <th>#</th> <th>Title</th> <th>Description</th> <th>Group/Assigned</th> <th>Advanced</th> </tr> </thead> <tbody> <tr ng-repeat="ticket in tickets"> <td>{{ticket.number}}</td> <td>{{ticket.title}}</td> <td>{{ticket.desc}}</td> <td>{{ticket.assigned.group}} / {{ticket.assigned.name}}</td> <td> <button class="btn btn-primary" ng-click="sendToSupport(ticket)">Send to Support</button> </td> </tr> </tbody> </table> </div>
我试过过滤 ng-repeat
| filter: {group: 'Support'}
并且不工作
正如您所看到的,我将对象发送到 ng-click
<tr ng-repeat="ticket in tickets"> <td>{{ticket.number}}</td> <td>{{ticket.title}}</td> <td>{{ticket.desc}}</td> <td>{{ticket.assigned.group}} / {{ticket.assigned.name}}</td> <td> <button class="btn btn-primary" ng-click="sendToSupport(ticket)">Send to Support</button> </td>
我正在做的是这个
$scope.sendToDev = function(ticket){
this.ticket.assigned.group = "Support"
}
似乎还可以?