我想知道是否有可能在按鈕上點擊複製父組件的html語法內的子組件模板?如何在父級內部點擊複製子組件模板? (angular2)
所以;
<child-component></child-component>
<span class="glyphicon glyphicon-plus" (click)="onDuplicate()"></span>
那麼一旦用戶點擊 '+' glyphicon和onDuplicate()函數被調用,,父有:
<child-component></child-component>
<child-component></child-component>
<span class="glyphicon glyphicon-plus" (click)="onDuplicate()"></span>
等等等等
我一直在四處尋找對於如何做這樣的事情,但找不到任何東西,所以我不知道從哪裏開始。我希望有人能夠指引我正確的方向?
感謝