# DataTable Component for Angular 2
## Install
```sh
npm set registry http://devproducts.alfresco.me:4873
npm install --save ng2-alfresco-datatable material-design-lite material-design-icons
```
## Basic usage
```html
```
```ts
import { Component } from 'angular2/core';
import {
ALFRESCO_DATATABLE_DIRECTIVES,
ObjectDataTableAdapter
} from 'ng2-alfresco-datatable/ng2-alfresco-datatable';
@Component({
selector: 'my-view',
template: '',
directives: [ALFRESCO_DATATABLE_DIRECTIVES]
})
export class MyView {
data: ObjectDataTableAdapter;
constructor() {
this.data = new ObjectDataTableAdapter(
// data
[
{ id: 1, name: 'Name 1' },
{ id: 2, name: 'Name 2' }
],
// schema
[
{type: 'text', key: 'id', title: 'Id', sortable: true},
{type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true}
]
);
}
}
```

## Build from sources
Alternatively you can build component from sources with the following commands:
```sh
npm install
npm run build
```
## Running unit tests
```sh
npm test
```
## Running unit tests in browser
```sh
npm test-browser
```
This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing.
## Code coverage
```sh
npm run coverage
```