2
如果能夠在不同的幻燈片中使用同一頁面上的不同模型兩次使用一個組件,該如何重用兩次?angular2:在同一頁面上重複使用公共組件兩次
例子:
<component [(model)]="model1"></component>
<component [(model)]="model2"></component>
如果能夠在不同的幻燈片中使用同一頁面上的不同模型兩次使用一個組件,該如何重用兩次?angular2:在同一頁面上重複使用公共組件兩次
例子:
<component [(model)]="model1"></component>
<component [(model)]="model2"></component>
在我的解決方案是與radioGroup中的元素 如果不是唯一的ID問題使用兩次組件,你必須記住,在不同的radioGroup中的元素有TI有不同的身份證的其他方式,你有第二,第三等模型的死鎖
可以使用ngFor。 TS文件:
var models = [model1, model2];
HTML文件:
<div *ngFor="let mod of models">
<component [(model)]="mod"></component>
</div>
我不能使用這種情況下,因爲他們必須在不同的幻燈片的應用程序(((( 我需要使用他們分開 –