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

Popular posts from this blog

javascript - Replicate keyboard event with html button -

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Web audio api 5.1 surround example not working in firefox -