What are AngularJS Tables

Sometimes a concept can be explained such a very complex way that listeners shall think it seems to very tough and may require more attention and study.

But it is not correct!

Everything can be explained and understand in easy way, which creates an image in listener’s mind that is not complex enough. Eventually, it creates interest as well.

In this article we’ll pick few topics of AngularJS which shall be required to us while programming. Let’s start with AngularJS Tables…

AngularJS Tables

This is not special except of being normal HTML table if it is static. Actual game starts when we want dynamic content to be displayed in HTML table using AngularJS, which used to be done earlier using regular JavaScript or server side programming. Let’s take an example:

In the above example, systemDetails is an AngularJS array property which holds records in JSON format as below:

{ “records”:[ {“HostName”:”Machine1″,”OS”:”Windows 10″}, {“HostName”:”Machine2″,”OS”:”Linux”} ] }


Machine1            Windows 10

Machine2            Linux

By above example we can understand, ng-repeat is perfect for displaying tables dynamically. Associated HTML element (i.e. tr) is repeated as same as number of records in array.

CSS Styles with AngularJS Tables

This styling automatically handles table’s style with alternate row styling.

Display index of table records

$index is used to show index of record which starts from 0 and increases by 1 with addition of new record.

Using $even and $odd

$even and $odd are used to show table cells on conditional basis of even or odd number of row.


Be  Connected…

Satyendra Mishra

Leave a Reply

Your email address will not be published. Required fields are marked *