作者名:Diego Jose Argüelles Rojas Erikson Haziz Murrugarra Sifuentes
本章字數:55字
更新時間:2021-06-25 20:58:19
Component encapsulation
Angular components need more explicit configuration and some (in some cases confusing) characters in the template. You can put the template in a separate file, or for simpler components, you can include the template inline:
/* product-list.component.ts */
@Component({
selector: 'product-list',
template: `<p><product-detail *ngFor="let thing of things" [product]="product" /></p>`
})
exportclassProductList {
public products:Product[];
}