首页 > 其他 > 详细

Angular

时间:2020-12-02 00:15:48      阅读:32      评论:0      收藏:0      [点我收藏+]

Angular

五个常用特性:

  • *ngFor
<h2>Products</h2>

<div *ngFor="let product of products">
</div>
  • *ngIf
<h2>Products</h2>

<div *ngFor="let product of products">

  <h3>
    <a [title]="product.name + ‘ details‘">
      {{ product.name }}
    </a>
  </h3>

  <p *ngIf="product.description">
    Description: {{ product.description }}
  </p>

</div>
  • 插值{{ }}
<div *ngFor="let product of products">

  <h3>
      {{ product.name }}
  </h3>

</div>
  • 属性绑定[ ]
<h2>Products</h2>

<div *ngFor="let product of products">

  <h3>
    <a [title]="product.name + ‘ details‘">
      {{ product.name }}
    </a>
  </h3>

</div>
<h2>Products</h2>
  • 事件绑定
<h2>Products</h2>

<div *ngFor="let product of products">

  <h3>
    <a [title]="product.name + ‘ details‘">
      {{ product.name }}
    </a>
  </h3>

  <p *ngIf="product.description">
    Description: {{ product.description }}
  </p>

  <button (click)="share()">
    Share
  </button>

</div>

Angular

原文:https://www.cnblogs.com/ed1s0n/p/14071273.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!