angularjs - ng-controller inside table does not work, why? -
<div ng-controller="xxxcontroller" > <table> <tr ng-repeat="x in xxxx"> <td>... </td> </tr> </table> </div>
ng-controller tag out side table, works fine.
but below if ng-contoller tag inside table , ng-repeat not work
<table> <div ng-controller="xxxcontroller" > <tr ng-repeat="x in xxxx"> <td>... </td> </tr> </div> </table>
<div>
isn't valid child element of <table>
. because of this, <div ng-controller="xxxcontroller">
moved outside <table>
, making <tr>
invalid, since outside <table>
.
in order <div>
inside <table>
need child of <td>
, think break structure have.
as alternative, valid syntax have ng-controller
on <table>
element itself:
<table ng-controller="xxxcontroller"> <tr ng-repeat'"x in xxx"> <td>... </td> </tr> </table>
Comments
Post a Comment