2

I'm working on big data tables and I need to have oportunity to set dynamic if I want to use virtual scroll or standard solution. On my prototype I used *ngIf and duplicated views for standard body and cdk virtual scroll vierport. Is there any possibilty to just disable virtual scroll, without building additional components for alternate views? Thanks in advance!

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57

1 Answers1

0

I believe you are asking for adding the virtual scroll directive based on a condition. In that case, it cannot be done at the moment. There is no way to add a directive to an element based on a condition. It has to be statically bound to the HTML to define it's behavior. There are 2 workarounds:

  1. Have two different views. One when the condition is true and one when the condition is false. I understand this is what you're doing right now.

  2. If you are the author of the directive, pass an argument to the directive to instruct it to not do anything. Unfortunately since you are using a library, this solution wouldn't be possible.

Please see here: https://github.com/angular/angular/issues/5332

Michael D
  • 20,838
  • 4
  • 12
  • 37