我以前曾試圖使用虛擬卷軸來製作一個數量不等的卡片。虛擬滾動不會與我的卡工作,並建議我嘗試ng-template
它不停地給我認爲這對終端的錯誤:如何讓ng-template在離子2項目中工作
Error: Template parse errors: [01:38:47] 'ng-template' is not a known element: [01:38:47] 1. If 'ng-template' is an Angular component, then verify that it is part of this module. [01:38:47] 2. If 'ng-template' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this
我試圖讓虛擬滾動工作有其他的解決方案給我留下了一張空白的,白色的,沒有記錄的頁面,這很奇怪,因爲你會認爲如果終端會告訴我一個錯誤,並且構建會失敗。我想試圖弄清楚如何讓ng-template
爲我工作。谷歌搜索沒有舉出足夠的例子。 這就是我最初使用virtualScroll
的方式,這是錯誤的做法。我試過在div和list元素中交換屬性,我得到了空白頁的相同結果。
HTML
<ion-content id="content">
<ion-card id="card" *ngFor="let event of listOfEvents
[virtualScroll]="listOfEvents">
<ion-item *virtualItem="let event">
<ion-row>
<ion-col>
<span class="showDetails">Guests Needed:</span> {{event.guests}}
</ion-col>
<ion-col>
<span class="showDetails">Cover:</span> {{event.coverCharge}}
</ion-col>
<ion-col>
<span class="showDetails">Drink Min:</span>{{event.drinkMin}
</ion-col>
</ion-row>
</ion-item>
</ion-card>
</ion-content>
你在哪個版本的角? – Dino
@masterfan我正在使用角2和離子2 .. – Spilot