I have a class containing function private receiveCheck
and protected dispatch
. I also want to call the private function in a callback, which I tried to bind to this
.
protected dispatch(ajaxParams: JQuery.AjaxSettings<any>): void {
ajaxParams.success = ((a: any, b: any) => {
console.log(this)
this.receiveCheck(0)
}).bind(this)
$.ajax(ajaxParams);
}
Unfortunately when the anonymous function is executed, it throws the following error:
Uncaught TypeError: _this.receiveCheck is not a function
EDIT: The log in the output is the Window object. Removing the bind
call does not solve this problem.