'disable ngdropdowntoggle in tag html in angular 13

i have an ngdropdownmenu , and I just want to "disable/enable" 'ngdropdowntoggle' by a condition .. if condition --> add ngdropdowntoggle

this is my code :

<button class="btn btn-outline-primary" type="button" ngbDropdownToggle> 
   {{buttonItem.titlee}}
 </button>


Solution 1:[1]

For your current case :

<button *ngIf="condition" class="btn btn-outline-primary" type="button" ngbDropdownToggle> 
   {{buttonItem.titlee}}
</button>

<button *ngIf="!condition" class="btn btn-outline-primary" type="button"> 
  {{buttonItem.titlee}}
</button>

For your custom directive you use structural directive like this :

<p *appUnless="condition" class="unless a">
  (A) This paragraph is displayed because the condition is false.
</p>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pterrat