javascript - How to pre select (pre click) first, or second table row in angularjs? -
i have 2 tables. in first table have table rows generated ng-repeat ng-click events. ng-click make request , output data in second table. second table empty first, , getting populated when `m clicking table rows first table. how can make request first table row (first table), or pre click , or pre select, can output default data in second table ?
table1 <tr ng-repeat="task in todos" ng-show="todos.length > 0" ng-click="updatetaskinfo(task)> <td ng-bind="task.stuffs"></td> </tr> table2 <tr ng-repeat="stats in statsfromtable1" ng-show="statsfromtable1.length > 0"> <td ng-bind="stats .stuffs"></td> </tr>
so table2 first empty, , when click table rows table1 make request, , pass data in table2.
problem: how can have default data in table2, such data first, or second table row in table1 ?
you can use ng-init
directive https://docs.angularjs.org/api/ng/directive/nginit. or can use $timeout in first table controller load default data second table
Comments
Post a Comment