如何在角度 6 的 mat-list-item 上使用禁用属性? [英] How to use disabled property on mat-list-item in angular 6?

查看:24
本文介绍了如何在角度 6 的 mat-list-item 上使用禁用属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带有 mat-list-items 的 mat-list,我使用 [disabled] 制作了名为 mat-list-item 的禁用状态,但它不起作用并给出类似错误(无法绑定到禁用",因为它不是'不是'mat-list-item'的已知属性)如何在角度6中禁用特定的mat-list-item?

I have mat-list which have mat-list-items, i make disabled Status named mat-list-item using [disabled] but it not works and give error like(Can't bind to 'disabled' since it isn't a known property of 'mat-list-item') How to make disabled particular mat-list-item in angular 6 ?

<mat-list>
  <mat-list-item routerLink="/base/notificstatus" [disabled]="payloadArray.enabled != 'true' ">Status</mat-list-item>
  <mat-list-item routerLink="/base/notifcategory">Category</mat-list-item>
</mat-list>

推荐答案

如果你想停止导航到那个页面,你可以使用 ponter-events

If you want to stop navigate to that page you can do it using ponter-events

pointer-events CSS 属性指定在什么情况下(如果任何)一个特定的图形元素可以成为鼠标的目标事件.

The pointer-events CSS property specifies under what circumstances (if any) a particular graphic element can become the target of mouse events.

<mat-list>
  <mat-list-item routerLink="/base/notificstatus"
 [ngStyle]="{'pointer-events':payloadArray.enabled == 'true' ?'auto':'none'}"
>Status</mat-list-item>
  <mat-list-item routerLink="/base/notifcategory">Category</mat-list-item>
</mat-list>

这篇关于如何在角度 6 的 mat-list-item 上使用禁用属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆