简体   繁体   中英

Angular 2 block ui component

What is the proper way to block the ui of a component in Angular 2?

Something like this

<component [blockUI]="true"></component>

In the component's less file put:

:host {
    pointer-events: none;
}

If you have components below, they will get the clicks, if you'd like to prevent this, instead of the css do:

<component (click)="$event.preventDefault()">

to make it dynamic, assuming you use less and have a variable called notInteractive :

:host {
  &.not-interactive {
    pointer-events: none;
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM