This hard coded call to my generic javascript function "openTab" works and the return value from openTab is false so the code will change/show tabs without submitting the form.
<button class="tablinks" onclick="return openTab(event,'tab1');">Tab 1</button>
As soon as I make this dynamic I run into several errors:
<ng-container *ngFor="let option of question.options">
<button class="tablinks" (click)="return openTab(event, option.tabId);">{{ option.tabName }}
</ng-container>
The above code is where I am trying to get to but the parser does not like having "(click)=return" and when I remove the return I get an exception "_co.openTab" is not a function.
Here are the things I have tried:
<button class="tablinks" onclick="return openTab(event, 'tab1');">{{ option.tabName }}</button>
The above works but the id is hard coded, the tabName is dynamic.
<button class="tablinks" onclick="return openTab(event, {{option.tabId}});">{{ option.tabName }}</button>
The code above gives the following error: Binding to event property 'onclick' is disallowed for security reasons, please use (click)=...
<button class="tablinks" (click)="return openTab(event, {{option.tabId}});">{{ option.tabName }}</button>
The code above won't parse due to the return: Parser Error: Unexpected token
<button class="tablinks" (click)="openTab(event, option.tabId);">{{ option.tabName }}</button>
The code above parses but when you click the button you get: TypeError: _co.openTab is not a function
<button class="tablinks" (myClick)="openTab(event, option.tabId);">{{ option.tabName }}</button>
The code above parses but when you click the button nothing happens, openTab is not called, no error
Any suggestions?