简体   繁体   中英

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.

Html

  • {{List1}}
  • {{List 2}}

typescript disable = true;

disabled attribute cannot be set on a list or a list item, it can only be used on the following HTML tags:

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

for your specific case, you can use this:

html

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

css:

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

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