I'm struggling to connect a parent class function with my Angular 2 PrimeNG menu options.
HTML
<p-menu #menu popup="popup" [model]="exportItems"></p-menu>
<button type="button" class="fa fa-download" title="Export As" (click)="menu.toggle($event)"></button>
Typescript
exportItems: MenuItem[];
//Within NgOnInit
this.exportItems = [
{ label: 'SVG', command: super.ExportSVG },
{ label: 'PNG', command: super.ExportPNG }];
//Error occurs here
//Cannot read property 'canvasID' of undefined
ExportSvg(): void
{
var canvas = document.getElementById(this.canvasID) as HTMLCanvasElement;
.....
}
It appears that the parent class function is not accessible when trying to bind to a command. Any ideas on how to resolve this issue?