angular 2 - 003 typescript

http://www.typescriptlang.org/docs/index.htmlhtml

var book: string = "hellp angular 2";
var num: number = 123;

function lg (msg :string): void{
  console.log(msg)
}

類和接口typescript

interface Shape{
  area(): number;
}

class Rectangle implements Shape{
  constructor(
      private width: number.
       private length: number
  ){}

//實現方法
  area(){
    return this.width  * this.length;
  }
}

裝飾器this

 

相關文章
相關標籤/搜索