Angular 2 Material Progress Spinner: display as overlay

后端 未结 3 2111
鱼传尺愫
鱼传尺愫 2020-12-06 02:19

How to display the Angular 2 Material Progress Spinner as a somewhat transparent overlay of the current view (a page or a modal dialog)?

3条回答
  •  [愿得一人]
    2020-12-06 03:04

    Use the below code to achieve the opaque:

    HTML

    COMPONENT

    import { Component, Input } from '@angular/core';
    
    @Component({
        selector: 'app-spinner',
        template: `
          
        `
    })
    export class SpinnerComponent {
      @Input() size = 50;
      @Input() show = false;
      
      showSpinner() {
        this.show = true;
      }
    }
    

    CSS

    .hide {
      opacity: 0;
    }
    

    LIVE DEMO

提交回复
热议问题