blob: 7e62235a4b3aa3e9ccea914f471d50b67194a97c [file] [log] [blame]
Matteo Scandolo44b7d6b2016-12-08 13:48:01 -08001import { Observable } from 'rxjs/Rx';
2/// <reference path="../../../../typings/index.d.ts"/>
3import { IXosTableConfig } from './../../interfaces/xos-components/table.interface';
4import {Component, OnInit, Input} from '@angular/core';
5
6@Component({
7 selector: 'xos-table',
8 template: require('./table.component.html'),
9})
10export class XosTableComponent implements OnInit {
11
12 public _config;
13 public _data;
14
15 @Input() config: IXosTableConfig;
16 @Input() data: Observable<any>;
17
18
19 ngOnInit() {
20
21 if (!this.config) {
22 throw new Error('[XosTable]: You must pass a configuration');
23 }
24
25 this._config = this.config;
26 this.data.subscribe(
27 (items: any[]) => {
28 this._data = items;
29 }
30 );
31 }
32}
33