I am looking to implement a feature where calling the method selections() from a button tooltip triggers a specific action and returns a string to be displayed when hovering over the tooltip. I attempted to interpolate the returned value in the HTML code, but it did not yield the desired result.
app.component.html
<button mat-raised-button
matTooltip={{selections()}}
matTooltipClass = "test"
aria-label="Button that displays a tooltip when focused or hovered
over">
Action
</button>
The function should return the string "selected" and display it when hovering over the tooltip.
app.component.ts
selections() {
this.selectedelems = [];
this.selection.selected.map(id => this.tableData.data.filter((row: any) =>
{
if (row._id === id) {
this.selectedelems.push(row.name);
this.selected = this.selectedelems.join('\r\n');
}
}));
return this.selected;
}