angular5 directive和component的區別

 

 

指令分爲三類,組件屬性指令結構性指令佈局

  • 組件(Component directive):UI組件,繼承於Directive
  • 屬性指令(Attribute directive):改變組件的樣式
  • 結構指令(Structural directive):改變DOM佈局

屬性指令例如 ngClass  ngStylespa

結構性指令   *ngIf    *ngFor   *ngSwitchcode

 

參考自http://mttcug.cnblogs.com/blog

相關文章
相關標籤/搜索