0
如何直接引用ng-template
中定義的html塊?如何直接引用ng-template中定義的HTML塊的角度?
要參考filterOfDiv
,我必須使用*ngIf
指令,並始終將條件設置爲true
。
<ng-container *ngIf='true; then filterOfDiv'></ng-container>
<ng-template #filterOfDiv>
<div class="flex-column row-space filter-container">
<div>
<input type="checkbox" id="company1"><label for="company1" class="label-input">company1</label>
</div>
<div>
<input type="checkbox" id="company2"><label for="company2" class="label-input">company2</label>
</div>
</div>
</ng-template>
是否有直接引用filterOfDiv
,就像一個辦法:
<ng-container filterOfDiv></ng-container>