htmlcssangulartypescriptng-zorro-antd

How can i get the viewport height of my modal in angular?


i would like to know if there is a possibility to get the viewport height of my ng boostrap modal in my Angular app. Here is what i have:

.modal-xxl {
  width: 95% !important;
  max-height: 90% !important;
  max-width: 95% !important;
  height: 90% !important;

  .component-host-scrollable {
    height: 100%;
  }
}


Solution

  • Okay so my problem was that this:

    [nzScroll]="{ y: 'calc(100vh - 276.09px)'}"
    

    Didn't work because of the point . in the calculation.

    So then i changed it to:

    [nzScroll]="{ y: 'calc(100vh - 276px)'}"
    

    And now works just fine. If anyone was wondering how i got that 276px i basically did a sum of all the modal elements that were of fixed size like:

    Therefore now if i decide to resize the window, the table scrollbar is going to resize as well.

    Here is the before:

    Table before

    And that is the after:

    Table after

    As you can see if i increase the size of the table the table doesn't overflow the modal causing him to enable the scroll bar, it just resizes itself staying within the modal boundries.