i have table receives data dataservice.js file , loops through each employee in array , creates new row display employee. right have set display message if no employees hired yet shows above table , still row in table if none found.
what need correct mistake i'm making?
<table class="table table-striped table-bordered"> <tr> <th>employee name</th> <th>street</th> <th>city</th> <th>state</th> <th>zip code</th> <th>actions</th> </tr> <tr ng-if="employeelist.length === 0">no employees hired.</tr> <tr ng-repeat="employee in employeeslist track $index"> <td>{{employee.employeename}}</td> <td>{{employee.employeestreet}}</td> <td>{{employee.employeecity}}</td> <td>{{employee.employeestate}}</td> <td>{{employee.employeezipcode}}</td> <td><span ng-click="deleteemployee(employee)" class="glyphicon glyphicon-remove"></span> </tr> </table>
update
anyone else know why showing above table?
<table class="table table-striped table-bordered"> <tr> <th>employee name</th> <th>street</th> <th>city</th> <th>state</th> <th>zip code</th> <th class="actions">actions</th> </tr> <tr ng-if="employeelist.length === 0"> <td colspan="6">no employees hired.</td> </tr> <tr ng-repeat="employee in employeeslist track $index"> <td>{{employee.employeename}}</td> <td>{{employee.employeestreet}}</td> <td>{{employee.employeecity}}</td> <td>{{employee.employeestate}}</td> <td>{{employee.employeezipcode}}</td> <td><span ng-click="deleteemployee(employee)" class="glyphicon glyphicon-remove"></span></td> </tr> </table>
should work fine if use valid html. browsers kick out invalid html , display outside of found
text can't inserted directly in <tr>
. use <td>
<tr ng-if="employeelist.length === 0"><td colspan="6">no employees hired.</td></tr>
Comments
Post a Comment