Web
Analytics
Installation of type script in visual studio code | Lecture -1 | Angular | ASP.NET Tutorials

For Consultation : +91 9887575540

Stay Connected :

  • Run Project Using Command Prompt.
  • Create Folder in D Drive
  • Create file app.ts
  • Open Command Prompt ,Reach upto File
  • Write Following Command : tsc app.ts
  • It will create an js file(app.js)
  • Run File : node app.js

Variable declaration in typescript:

Variable Declared in Method of any Class and outside the class Always declared using var keyword.

Example: var num5: number = 10;

Class Variable declare without var keyword.

Example

  • num1: number = 10;
  •     name: string = “CEG”;
  •     name2: string = “CEG123”;
class Greeter {
    num1: number = 10;
    name: string = "CEG";
    name2: string = "CEG123";
    getcontent(): void {
        alert('Class Function');
    }
    sethtmlvalue(ctrlid: string, text: string): any {
        var e1: HTMLElement = document.getElementById(ctrlid);
       var num5: number = 10;

        e1.innerText = text;
    }

   

}

window.onload = () => {
    var gobj = new Greeter();
    //alert(gobj.name);
    var c: number = 10;
    var d: string = "Yogesh";   
    //alert(gobj.num1);
    gobj.getcontent();
    gobj.sethtmlvalue('content', "This is Dynamic Value");
};
//function myfun() {
//    alert('hello');
//}
//var myfun = () => {
//    alert('hello from myfun');
//}