Skip to main content

Posts

Showing posts from March, 2016

How to use THIS keyword inside a typescript callback method

When using callbacks in Typescript you  would (most of the time) want to invoke object reference methods instead of static methods. To do this you would need to make use of the "this" keyword inside the callback, but you need to define the callback in a certain way otherwise "this" refers to the callback itself. The correct way to define the callback method is: If you are expecting a JSON result in the callback you can define the callback to use parameters like this: