With the following code
<form>
<select class="attkOptions" *ngFor="let subString of Attack.currentText" placeholder="" onchange="dumpValue(value)">
<option [value]="{'index':Attack.currentText.indexOf(subString)}">{{subString.text}}</option>
<option *ngFor="let option of subString.options" [value]="{'index':Attack.currentText.indexOf(subString),'option':option}">
{{option}}
</option>
</select>
</form>
and component
export class Patterns implements OnInit, OnDestroy, OnChanges {
...
dumpValue(object) {
console.log(object.index);
}
...
}
I am getting the following error
Uncaught ReferenceError: dumpValue is not defined at HTMLSelectElement.onchange (module:18:9)
. I am able to call functions in my class in other points of the code, so my deduction is that by using it within ngFor, I somehow leave the scope of my class (and in fact, calling the function elsewhere in code works as expected.
How can I specify the scope of function to be within my class?