javascript - How is the mat-spinner rendered inside the mat-table? - Stack Overflow

I'm wondering whyhow the material spinner is rendering inside the table in this example:<div

I'm wondering why / how the material spinner is rendering inside the table in this example:

    <div class="course">

        <div class="spinner-container" *ngIf="dataSource.loading$ | async">
            <mat-spinner></mat-spinner>
        </div>

        <mat-table class="lessons-table mat-elevation-z8" [dataSource]="dataSource">
            ....
        </mat-table>
    </div>

The table does not reference the spinner, so how does it render it inside the content area?

I'm wondering why / how the material spinner is rendering inside the table in this example:

    <div class="course">

        <div class="spinner-container" *ngIf="dataSource.loading$ | async">
            <mat-spinner></mat-spinner>
        </div>

        <mat-table class="lessons-table mat-elevation-z8" [dataSource]="dataSource">
            ....
        </mat-table>
    </div>

The table does not reference the spinner, so how does it render it inside the content area?

Share Improve this question asked Jul 27, 2019 at 6:37 OleOle 47.5k70 gold badges238 silver badges445 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

It is not rendering the mat-spinner inside mat-table, just using the same css as table body. It seems that the spinner is inside the table but actually it's not, even when dataSource is loading, table's header is present. By assigning same css as table body to spinner container, it seems the spinner is in table body:

<div class="spinner-container" *ngIf="dataSource.loading$ | async">
     <mat-spinner></mat-spinner>
</div>

css:

.spinner-container {
  display: flex; 
  justify-content: center; 
  align-items: center; 
  background-color: #fafafa; 
  box-shadow:0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12)
}

DEMO.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744306460a4567736.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信