I'm using Angular2 and I'm trying to add a view link for each row in my Smart Table. I'm doing this using the custom type which allows me to render a custom component.
The rendering process is working well but now I need to pass data (item's id) to the custom component and I have no idea how the data is being sent to the templates so I can't have access to it.
Here's my table component:
export class ShowLoans {
query: string = '';
settings = {
actions: {
delete: false,
add: false
},
columns: {
//...
actions: {
title: 'Acciones',
type: 'custom',
renderComponent: ViewLoan
}
}
};
source: LocalDataSource = new LocalDataSource();
constructor(protected loanService: LoanService) {
this.loanService.getAllLoans().subscribe((data) => {
this.source.load(data.loans);
});
}
And here's my custom component:
@Component({
selector: 'viewloan',
templateUrl: './viewLoan.html'
})
export class ViewLoan {
public loan: Loan;
constructor(){
}
}
**NOTE: The ViewLoan component is declared as an entryComponent.