I have angular application and calling one of my methods as callback(i do understand it's not the best practice in Angular but this is not a point of this question).
Inside of my class I have something like this:
My code looks like:
protected updateCtapIctapAdjudication(event: {aidx: number, value: boolean, comment: string}): Observable<AdjudicationResponse> {
console.log(this.doUpdateCtapIctapAdjudication);
return this.doUpdateCtapIctapAdjudication(event.aidx, event.value, event.comment);
}
protected doUpdateCtapIctapAdjudication(aidx: number, value: boolean, comment: string): Observable<AdjudicationResponse> {
console.log('TESTING');
return of();
}
What error I get:
Which seems to be quite simple code. When I run updateCtapIctapAdjudication()
I see console.log
inside of that method say that doUpdateCtapIctapAdjudication
is undefined
and line after that throw error that doUpdateCtapIctapAdjudication
is not a function.
This is really strange as method is defined one line below in a same class. I was wondering what I am doing wrong.
What I tried:
As we all do when debugging I tried to simplify code as much as possible and run code below in chrome dev tools and things works fine:
class MyClass {
updateCtapIctapAdjudication(event) {
console.log(this.doUpdateCtapIctapAdjudication);
return this.doUpdateCtapIctapAdjudication(event);
}
doUpdateCtapIctapAdjudication(x) {
console.log('TESTING');
}
}
x = new MyClass();
this.doUpdateCtapIctapAdjudication();
I'm obviously overlooking something but I don't know what, is there something I should focus on to debug this?