Skip to content Skip to sidebar Skip to footer

Why Does Adding An Ng-repeat To My AngularJS Template Break It?

I have an AngularJS directive whose template file looks like this: path/to/myDirectiveA.template.html: Statement

Solution 1:

<tbody>
<tr ng-repeat="currRow in [0, 1, 2, 3]">
<td bgcolor='#7cfc00'>Statement</td>
<td bgcolor='#7cfc00'>MyDirectiveACtrl.a.b</td>
<td bgcolor='#ff1493'>{{MyDirectiveACtrl.a.b}}</td>
<td bgcolor='#7cfc00'>{{currRow}}</td>
</tr>
</tbody>

update your myDirectiveA.template.html .Hope it helps you :)


Solution 2:

may this solve the problem ($parent)

<tr ng-repeat="currRow in [0, 1, 2, 3]">
    <td bgcolor='#7cfc00'>Statement</td>
    <td bgcolor='#ff1493'>{{$parent.a.b}}</td>
    <td bgcolor='#7cfc00'>{{currRow}}</td>
</tr>

Post a Comment for "Why Does Adding An Ng-repeat To My AngularJS Template Break It?"