Angularjs Can';t访问ng repeat';s变量来自其中的指令

Angularjs Can';t访问ng repeat';s变量来自其中的指令,angularjs,angularjs-directive,angularjs-ng-repeat,Angularjs,Angularjs Directive,Angularjs Ng Repeat,因此,我认为: <tr ng-repeat="currentRow in rowsToRender"> <td>{{currentRow[0]}}</td> <div rmx-schedule-row time="currentRow" time-from="{{currentRow[0]}}" time-to="{{currentRow[1]}}" date="{{dateStr}}"/> </tr> 在视图中,正确计算curren

因此,我认为:

<tr ng-repeat="currentRow in rowsToRender">
<td>{{currentRow[0]}}</td>
<div rmx-schedule-row time="currentRow" time-from="{{currentRow[0]}}" time-to="{{currentRow[1]}}" date="{{dateStr}}"/>
</tr>
在视图中,正确计算currentRow[0]并打印预期值

但在指令中,currentRow[0]和[1]被插值为空字符串(“”),而对象
time
被插值为未定义。如果我想找出一个打字错误或是别的什么,我会发疯的:(


我尝试了
$scope.$watch
,结果相同。

尝试使用$parse服务从指令解析scope变量

time = $parse(attr.currentRow)($scope)
我猜表中的
是一个打字错误,这导致插值自动失败。将其替换为
,您将赢得:

或者,您可能想将div包装在表单元格中:

<td>Stuff
    <div></div>
</td>
东西

如果您有currentrow,则需要传递currentrow[0]和currentrow[1]什么。请将您的完整代码与rowstorender对象共享,或者只设置一个插件演示程序。如果代码是复制/粘贴的,则内部的
未关闭-
<td>Stuff
    <div></div>
</td>