如何使用ng-repeat從數組中的對象顯示特定屬性。這些電子郵件領域是我想顯示如何使用ng-repeat從數組中的對象顯示特定屬性
JSON什麼:
[
{
"TypeId": 3,
"Type": "Listings",
"emails": [
"[email protected]",
"[email protected]",
"[email protected]"
]
}
]
控制器:
myService.getEmails().then(function (emails) {
if (emails && emails.length) {
$scope.emailsList = emails
}
})
HTML:
<tr ng-repeat="item in emailsList['emails'] track by $index">
<td>
<div class="rounded-checkbox">
<input class="form-check-input" type="checkbox">
<span></span>
</div>
</td>
<td class="col-xs-12">{{ item }}</td>
<td>-</td>
</tr>
號我想只顯示郵件。 結果如下: {「TypeId」:3,「Type」:「Listings」,「emails」:[「[email protected]」,「[email protected]」,「[email protected]」 ]} –
$ scope.emailsList包含什麼? – Vivz
$ scope.emailsList = {[ 「TYPEID」:3, 「類型」: 「房源」, 「電子郵件」: 「[email protected] COM」, 「someemail3 @ EXA mple.com 「, 」someemail [email protected]「 ] }] –