1
是否有任何方法可以將動態元素添加到特定位置,而不需要#localvariable
(<input type='button' #localvariable (click)='doSomething()'>
)。將元素編譯到指定位置,沒有#本地變量
例如,給定:
<td></td>
編譯之後:
<td><input type='button' (click)='doSomething()'></td>
這是工作。謝謝。 –
使用'ComponentFactory.create'我們如何將數據傳遞到組件。和我的第二個問題是否可以傳遞元素作爲一個字符串,而不是組件。 –
'compRef.instance.someField ='foo';'https://stackoverflow.com/questions/36325212/angular-2-dynamic-tabs-with-user-click-chosen-components/36325468#36325468也顯示如何做到這一點。 –