[Angular2]Record Some Common of Decorator And Componet[1]

參考 https://egghead.io/lessons/angular-2-say-hello-world-to-angular-2

參考 https://angular.io/docs/ts/latest/tutorial/toh-pt2.html

html 符號:

  • ():事件,OneWayToSource
  • []:屬性,OneWay
  • ([]):Twoway,不建議
  • #:template的變數,產生於template。local template variable. We can reference this variable within the template to access a hero’s properties.
  • *:Master與Detail的關係,用在Detail(child),如*ngFor。The (*) prefix to ngFor indicates that the <li> element and its children constitute a master template.

Decorator:

  • Output: 等於事件,由控件內部引發,並傳出$event。搭配EventEmitter一起使用
  • Input: 使用方輸入至控件端。
  • Injectable: 要分享資料或服務可使用,宣告時使用Injectable 。Service,singleton
  • Inject: 使用Service,要引用。搭配provide使用,可想像成工廠或IOC方式調用與。
  • Pipe:name:外部引用使用名稱
  • Component:
    1. selector:外部引用使用名稱
    2. template:html模板
    3. directives:外部Components引用。
    4. pipes:外部pipes引用

 

藍小伙-學習筆記,若本文有錯誤的觀念,歡迎不吝指正。