0
我想創建一種容器組件來修改ng內容中列出的所有(父級)標籤。例如:ng-content中的foreach htmlelement
例如,此容器中的所有標籤都應包裝在引導行內以定義響應。
這是可能的。喜歡的東西
<ng-content *ngFor="let tag of tags"
<row>{{tag}}<row>
</ng-content>
我想創建一種容器組件來修改ng內容中列出的所有(父級)標籤。例如:ng-content中的foreach htmlelement
例如,此容器中的所有標籤都應包裝在引導行內以定義響應。
這是可能的。喜歡的東西
<ng-content *ngFor="let tag of tags"
<row>{{tag}}<row>
</ng-content>
更新角5
ngOutletContext
更名爲ngTemplateOutletContext
參見https://github.com/angular/angular/blob/master/CHANGELOG.md#500-beta5-2017-08-29
原
<ng-content *ngFor="..."
是無意義。它會創建tags.length
<ng-content>
個元素,其中只有第一個元素生效。
可以使用<template>
和ngForTemplate
或ngTemplateOutlet
實現類似的東西
見ALS