2016-03-02 1 views
0

В моей таблице, у меня естьнг-включают в нг-таблицы не работает

<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 в тот же вид, то он работает.

ответ

1

Не совсем понятно, что происходит, но и 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 ребенка на каждой итерации