Consider the TypeScript snippet below:
export class MyClass {
myMethod() {
// ...
$myQuery.each(function(idx, elm) {
$(this)... // Original javascript code which obviously not correct in typescript
}
}
}
However, in TypeScript, within a class method, "this" always refers to the class instance. How can I access the original JavaScript context (this) in a callback when using TypeScript?