<div *ngFor="let product of products">
*ngFor循环遍历products数组(类似vue的v-for)
<a [title]="product.name + ‘ details‘"> {{ product.name }} </a>
[title]数据绑定(类似vue的v-bind?)
<p *ngIf="product.description"> Description: {{ product.description }} </p>
*ngIf如果有则显示,没有则不显示(类似vue的v-if)
<button (click)="share()"> Share </button>
(click)事件绑定(类似vue的v-on)
原文地址:https://www.cnblogs.com/foreversimon/p/12221960.html
时间: 2024-10-06 21:06:55