简体   繁体   English

禁用列表项 Angular 8

[英]Disable list item Angular 8

I want to disable list item based on condition please help me in this.我想根据条件禁用列表项,请帮助我。 In this i want to disable List2 if disable = true.在此我想禁用 List2 如果禁用 = true。

Html Html

  • {{List1}} {{列表1}}
  • {{List 2}} {{列表 2}}

typescript disable = true; typescript 禁用 = 真;

disabled attribute cannot be set on a list or a list item, it can only be used on the following HTML tags: disabled属性不能在列表或列表项上设置,它只能用于以下 HTML 标签:

<button>    
<fieldset>  
<input> 
<keygen>    
<optgroup>  
<option>    
<select>    
<textarea>  

for your specific case, you can use this:对于您的具体情况,您可以使用:

html html

<li [class.disabled]="disabled"> something</li>

css: css:

li.disabled{
 cursor: not-allowed;
 opacity: .7;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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