import { Component } from '@angular/core'; import { LocalDataSource } from 'ng2-smart-table'; import { SmartTableData } from '../../../@core/data/smart-table'; @Component({ selector: 'ngx-smart-table', templateUrl: './smart-table.component.html', styleUrls: ['./smart-table.component.scss'], }) export class SmartTableComponent { settings = { add: { addButtonContent: '', createButtonContent: '', cancelButtonContent: '', }, edit: { editButtonContent: '', saveButtonContent: '', cancelButtonContent: '', }, delete: { deleteButtonContent: '', confirmDelete: true, }, columns: { id: { title: 'ID', type: 'number', }, firstName: { title: 'First Name', type: 'string', }, lastName: { title: 'Last Name', type: 'string', }, username: { title: 'Username', type: 'string', }, email: { title: 'E-mail', type: 'string', }, age: { title: 'Age', type: 'number', }, }, }; source: LocalDataSource = new LocalDataSource(); constructor(private service: SmartTableData) { const data = this.service.getData(); this.source.load(data); } onDeleteConfirm(event): void { if (window.confirm('Are you sure you want to delete?')) { event.confirm.resolve(); } else { event.confirm.reject(); } } }