We have a services.ts file that requires 2 arguments.
UPDATE: It appears that I was looking at the error incorrectly. This method is causing the console error:
private checkLink(row, options) {
if (options.type === 'link' || options.type === 'custom-method') {
if (options.type === 'link' || (options.type === 'custom-method' && (row.user_id === this.userData.id) || this.authService.permission('view_subject_data') || this.userData.id === row.section.user_id || this.userData.id === 1)) {
if (options.permission) {
if (this.authService.permission(options.permission)) {
this.router.navigate([`${options.link}/${row[options.linkKey]}`]);
}
} else {
this.router.navigate([`${options.link}/${row[options.linkKey]}`]);
}
}
}
}
I am calling it in my HTML table which is used by many components.
<span [innerHtml]="datatableService.setColumnData(row[column.prop], column.options, row)"
Here is the data that I am passing to setColumnData
:
columns = [
{
name: 'User',
prop: 'last_name',
options: {
type: 'piped',
pipes: ['displayFullName']
},
},
{
name: 'Action',
prop: 'description'
},
{
name: 'Time',
prop: 'created_at',
options: {
type: 'piped',
pipes: ['formatDateTime']
},
},
];
This gives me an error of type undefined
, but the code works. I just need to get rid of the console.log error.
https://i.sstatic.net/Z5UJE.png
I know I just need to supply the necessary arguments like this, and it works without errors:
{
name: 'Action',
prop: 'description',
options: ''
},
However, the issue is that I need to modify all similar instances of the columns
variable throughout the project. Is there an easier or cleaner way to accomplish this?