Skip to main content

Posts

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:

How to update NuGet Package Manager (NPM) in Visual Studio

How to update your NuGet package manager in Visual Studio. Follow these steps to update NPM in Visual Studio: Click Tools -> Extensions And Updates Select " Updates"  on the left, and then "Visual Studio Gallery" Select NuGet Package Manager  and click Update Accept the agreement NuGet Package Manager is now successfully updated

How to add Typescript and get it to compile in your new Visual Studio project

TypeScript lets you write JavaScript the way you really want to. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open Source. Typescript is great!! ...once you get it working in your Visual Studio project It allows you to use strongly typed objects in Javascript saving you valuable development time and also minimizes your debugging time by throwing compile-time errors. IMPORTANT: Please ensure that you have the latest version of NuGet Package Manager installed in Visual Studio. To install or to update your NuGet Package Manager please see THIS post. To start using Typescript in your projects follow these steps: Create a new project Add a new typescript file and make sure that the Build Action is set to "Typescript Compile" Right click your project in the solution explorer and select "Unload Project" Right click your project again and select  "Edi...