ng-include in ng-table 不起作用
ng-include in ng-table doesn't work
在我的表格中,我有
<tr
ng-repeat="question in $data"
ng-include="'/views/partials/questionList.html'"></tr>
在questionList.html
,我有:
<td class="top-td" data-title="'ID'" sortable="'id'">
<a href="#" ng-click="loadQuestionModal(question.id)">
{{ question.id }}
</a>
</td>
<td class="top-td" data-title="'Question / Instruction'">
<h6 markdown-to-html="question.Instruction.instructionText"></h6>
<blockquote ng-show="k8englishSubject" markdown-to-html="question.questionText"></blockquote>
<blockquote markdown-to-html="question.questionText" mathjax-bind="question.questionText" ng-show="k8mathSubject"></blockquote>
</td>
<td class="top-td"><ng-include src="'/views/partials/answerList.html'"></ng-include></td>
<td class="top-td" ng-show="k8englishSubject">
<a ui-sref="passages.upsert({passageId: question.PassageId})" ng-show="question.PassageId">
{{ question.Passage.passageTitle }}
</a>
</td>
<td class="top-td" data-title="'Level'" sortable="'level'">{{ question.level }}</td>
但是,这不会呈现任何标题。但是,如果我有一个常规tr
并将td
放在同一个视图中,那么它就可以了。
不完全清楚发生了什么,但ng-repeat
和ng-include
都创建了子作用域。
我建议你用你自己的指令替换ng-include
以避免额外的子范围
<tr ng-repeat="question in $data" my-directive></tr>
.JS
app.directive('myDirective',function(){
return {
restrict:'A',
templateUrl:'/views/partials/questionList.html';
};
});
就目前而言,该指令的唯一功能是提供模板,它将在每次迭代中继承ng-repeat
子项的父范围
相关文章:
- 角度ng变化或ng点击选择can'不起作用
- AngularJS ng include dons'不起作用
- ng disabled在chrome中不起作用.按钮在角度上未禁用
- 角度无线电按钮ng模型不起作用
- Angular js+ng repeat+字母数字索引不起作用
- 角度Js ng-disabled不起作用
- AngularJS ng include won'不知什么原因不起作用
- 角度过滤器和ng点击不起作用
- 初始化ng模型时,Angular ui选择占位符不起作用
- 角度去抖动(ng模型选项)不起作用
- angularjs ng点击运行时标记不起作用
- Ng点击don´不起作用
- 为什么ng节目不起作用
- 带有粘性标题的角度ng视图不起作用
- select中布尔值的Angularjs ng值不起作用
- ng模型在$(element).clone()之后不起作用
- AngularJS触发ng更改不起作用
- ng-include in ng-table 不起作用
- Angular + ngRoute + ng-table不起作用
- 为什么ng-repeat对table不起作用