I want to load a component when click a row of my table. you can see my table.
I had made this table as if a row clicked alert will show as THIS ROW HAS CLICKED.
I used it for check weather row clicking is working or not. Hence now I can say It is working.
But actually I want to display the details of relevant row which was clicked, by open a component and inside it.

My code as follow, I using this table in finished component.
finishing.component.ts
import { Component, OnInit } from '@angular/core';
import { Finished } from './finished.model';
import { FinishedService } from './finished.service';
@Component({
selector: 'ngx-finished',
styles: [],
template: `
<ng2-smart-table
[settings]="settings"
(userRowSelect)="onCustomAction($event)"
[source]="list"
></ng2-smart-table>
`
})
export class FinishedComponent implements OnInit {
list: Finished[] = [];
constructor(private service: FinishedService) {}
ngOnInit() {
this.service.getPatients().subscribe(actionArray => {
let patients_data = actionArray.payload.get('data');
if (patients_data) {
this.list = patients_data;
}
});
}
settings = {
add: {
addButtonContent: '<i class="nb-plus"></i>',
createButtonContent: '<i class="nb-checkmark"></i>',
cancelButtonContent: '<i class="nb-close"></i>',
confirmCreate: true
},
edit: {
editButtonContent: '<i class="nb-edit"></i>',
saveButtonContent: '<i class="nb-checkmark"></i>',
cancelButtonContent: '<i class="nb-close"></i>',
confirmSave: true
},
delete: {
deleteButtonContent: '<i class="nb-trash"></i>',
confirmDelete: true
},
view: {
viewButtonContent: ''
},
columns: {
nic: {
title: 'NIC'
},
name: {
title: 'Name'
},
address: {
title: 'Address'
},
email: {
title: 'Email'
},
haircolor: {
title: 'Hair Color'
}
}
};
onCustomAction(event) {
alert(`THIS ROW HAS CLICKED`);
}
}
I want to invoke the above mentioned component inside onCustomAction function.
onCustomAction(event) {
I want to invoke the above mentioned component in here.
}