我想将 {{trade}} 及其父级传递给 open 函数。
当我单击 li 时,我希望父(股票代码)数据和子(交易)数据显示在警报框中。
这是 plunkr:http ://plnkr.co/edit/QuG8NcOvPKVAnfRNYwlx?p=preview
html:
<table ng-controller = "TickerListCtrl">
<thead>
<th>Symbol</th>
</thead>
<tbody ng-repeat="ticker in tickers">
<tr ng-click="showTrades(ticker)">
<td>{{ticker.Ticker}}</td>
</tr>
<tr ng-show="ticker.showTrades">
<td colspan="2">
<ul ng-repeat="trade in ticker.trades">
<li ng-click="open(trade)">{{trade}}</li>
</ul>
</td>
</tr>
</tbody>
</table>
代码:
$scope.tickers = [
{
"Ticker": "4512",
"TradeCount": "91",
"trades" :
[{
"one": "this one",
"two": "this two",
"three": "this three"
},
{
"one": "this one",
"two": "this two",
"three": "this three"
},
{
"one": "this one",
"two": "this two",
"three": "this three"
},
{
"one": "this one",
"two": "this two",
"three": "this three"
},
{
"one": "this one",
"two": "this two",
"three": "this three"
},
{
"one": "this one",
"two": "this two",
"three": "this three"
},
{
"one": "this one",
"two": "this two",
"three": "this three"
}]
}]