【发布时间】:2016-06-13 17:35:02
【问题描述】:
我对此进行了很多搜索,但找不到合适的答案。如果我再次问这个问题,我很抱歉。我是 Angular.js 的新手
我的代码:
<table>
<tr>
<th ng-repeat="x in setno" ng-init="parentset=$index">SET {{ x.alpha }}</th>
</tr>
<tr ng-repeat="(parentset,ques) in selected">
<td ng-repeat="x in setno">
<select ng-model="ques" ng-options="y.name for y in topics"></select>{{ques.qid}}
</td>
<td>{{$parent.ques.qid}}hi</td>
</tr>
<tr>
<td ng-repeat="x in setno">
<button ng-click="addques($index,ques.qid)" ng-model="ques.quid">add{{$parent.ques.qid}}</button>
</td>
</tr>
</table>
ques ng 模型在 select 标签之后但仅在 td 标签内 工作正常。我如何在该特定标签之外使用它。
即,这里:
<td>{{$parent.ques.qid}}hi</td>
和这里:
<button ng-click="addques($index,ques.qid)" ng-model="ques.quid">add{{$parent.ques.qid}}</button>?
我试过 $parent 并且没有它,但它不起作用。 我哪里错了?
【问题讨论】:
-
你在问这个问题之前没有搜索:google.com/…
标签: angularjs