I am trying to use cdk-virtual-viewpoint in my chat application. Sadly, it doesn't render anything. When I try to use the normal "ngfor" it works fine. But when I use cdkVirtualfor it does not display anything. Please refer to the code below for more details.
chatbox.component.ts---
<cdk-virtual-scroll-viewport itemSize="100" class = "cdk">
<div *cdkVirtualFor="let item of chat_history" class="chat-data">
<ul>
<li class = "me">{{item.message}}</li>
</ul>
</div>
</cdk-virtual-scroll-viewport>
app.module.ts------
@NgModule({
declarations: [AppComponent, ChatboxComponent],
imports: [BrowserModule, AppRoutingModule, HttpClientModule, ScrollingModule],
providers: [{provide: APP_BASE_HREF, useValue: '/consumer/'}],
bootstrap: [AppComponent],
})
chatboxcomponent.css-----
.form-container .chat-data {
height: 100px;
}
.form-container .cdk {
height: 500px;
}
Please let me know on what I am doing right. Trust me on this but chat history does have data. I have checked it.