我是學習AngularJs的新手。如何顯示所選選項的adSet詳細信息?在Angularjs中顯示所選選項的詳細信息
這裏是我的app.js文件:
app.controller("AddCompaignCtrl", function($scope){
$scope.status = ['active', 'inactive', 'closed'];
$scope.objectives = ['obj1', 'obj2', 'obj3', 'obj4'];
$scope.selectedCompaign = "Default-Campaign name";
$scope.selectedCompaign_id =0
$scope.compaigns = [
{
id: 0,
name: 'testCompaign 0',
detail: {
status : 'active',
objective: 'obj1'
},
adsets:[{
name :"adset 01",
status:"active",
budget:"5000",
date :"2013-12-12"
},
{
name :"adset 02",
status:"active",
budget:"5000",
date :"2013-12-12"
}
]
},
{
id: 1,
name: 'testCompaign 1',
detail: {
status : 'inactive' ,
objective: 'obj2'
},
adsets:[{
name :"adset 11",
status:"active",
budget:"5000",
date :"2013-12-12"
}
]
}];
這裏是我的HTML文件:
<div ng-repeat='compaing in compaigns'>
<div> {{compaing.name}}
<label>
<input type="radio" name="campaign" value='{{compaing.id}}' ng-model='$parent.selectedCompaign'>
</label>
</div>
</div>
<div class="row">
<div class="col-md-3 column" ng-model ='selectedCompaign'>Campaign Name</div>
<div class="col-md-9 column"> {{selectedCompaign }} </div>
</div><br>
我可以顯示所選戰役ID,但如何在下面顯示選定的戰役adset細節HTML表格?
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Budget</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr>
<td>adset1</td>
<td>Some</td>
<td>$502</td>
<td> 2012-12-12</td>
</tr>
<tr>
<td>Addset 2</td>
<td>Joe</td>
<td>$6034</td>
<td> 2012-12-12</td>
</tr>
</tbody>
</table>
我已經嘗試了這一個,但沒有顯示:
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Budget</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat='adset in compaigns[selectedCompaign].adsets'>
<td>{{adset.name}}</td>
<td>Some</td>
<td>$502</td>
<td> 2012-12-12</td>
</tr>
</tbody>
</table>
什麼讓你回來? – gkalpak
我試圖顯示所選compaign的addset,但沒有顯示。 –
請查看當前更新的問題。包括我想要做的事情。 –