0.2.0 • Published 7 years ago
ng-data-table v0.2.0
ng-data-table
A data table for Angular 1.
This library provides a fully customizable data table for Angular 1 projects. It aims to be lightweight and have an expressive markup.
Usage
Add this library as a dependency of your app or module:
const myApp = angular.module('myApp', ['ngDataTable']);
Declare some data to display:
myApp.controller('myController', class MyController {
$onInit() {
this.data = [
{ id: 1, firstName: 'Marie', lastName: 'Curie', birthDate: new Date('1867-11-07') },
{ id: 2, firstName: 'Albert', lastName: 'Einstein', birthDate: new Date('1879-03-14') },
]
}
});
In your templates, declare the data table markup:
<body ng-app="myApp" ng-controller="myController as $ctrl">
<ng-data-table source="$ctrl.data">
<column name="firstName" header="First Name"></column>
<column name="lastName" header="Last Name"></column>
<column header="Birth Date">
{{ $row.birthDate | date:'fullDate' }}
</column>
<column>
<header><strong>Age</strong></header>
<cell>{{ Math.floor(Date.now() - $row.birthDate / 3.15576e10) }}</cell>
</column>
</ng-data-table>
</body>
Documentation
Patience is the mother of all virtues.