2022年9月28日 星期三

Angular *ngIf(13)

html部分
<button class="btn-primary btn" (click)="CountPlus()">點我點我</button>

<p *ngIf="count % 2 == 1">
  {{count}}  以下是另一個Directives,被移掉後再回來就不再是原本的component,可用ngStyle那個component來測試以下
  <br />
  <app-attribute-directives></app-attribute-directives>
</p>

ts部分
 count = 1;

  CountPlus() {
    this.count++;
  }
參考資料
1.保哥的Angular 開發實戰:從零開始
2.Angular官網