import { Component, OnInit, Input, HostListener } from '@angular/core';

import { Table } from '../model';

const id = 'bs4-table-details-back';

@Component({
    selector: id,
    template: `
        <span class="material-icons">chevron_left</span>
        <strong> {{backText}} </strong>
    `,
    styles: [
        `
        :host {
            cursor: pointer;
        }
        `
    ]
})
export class Bs4TableDetailsBackBtCmp implements OnInit {

    @HostListener('click') back() {
        this.table.selectedRow = undefined;
    }

    @Input() backText: string = 'Back to list';
    @Input() table: Table<any>;

    constructor() { }

    ngOnInit() { }
}
