我以前曾试图使用虚拟卷轴来制作一个数量不等的卡片。虚拟滚动不会与我的卡工作,并建议我尝试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