<span *ngIf = "!slot.teiletyp.finished; else finishedPart" mat-line>
Charge: {{ queue.box.batch_number }}
</span>
<ng-template #finishedPart>
<span mat-line >Fertigteilbox</span>
<mat-menu #menu = "matMenu">
<button mat-menu-item (click) = "boxClicked(queue.box)">boxdetail</button>
<button mat-menu-item (click) = "openBoxes(queue.box.id)">offenebox</button>
</mat-menu>
</ng-template>
here i am trying to open a menu in the else part but i am unable to doso. can someone help me with this.
Спасибо





По умолчанию меню не открывается. Вы должны добавить триггер меню, чтобы открыть меню. В вашем случае лучшим решением было бы просто использовать mat-button в вашем шаблоне.
<span *ngIf = "!slot.teiletyp.finished; else finishedPart" mat-line>
Charge: {{ queue.box.batch_number }}
</span>
<ng-template #finishedPart>
<span mat-line>Fertigteilbox</span>
<div>
<button mat-button [ngStyle] = "{'width':'100%'}" (click) = "boxClicked(queue.box)">boxdetail</button>
<mat-divider></mat-divider>
<button mat-button [ngStyle] = "{'width':'100%'}" (click) = "openBoxes(queue.box.id)">offenebox</button>
</div>
</ng-template>