Search code examples
htmlangularcommentsangular-template

Comment out a single directive or property in Angular html template


Is there a way to comment out lines with *ngIf, (opened), [expanded] in this example?

    <mat-expansion-panel
         *ngIf="block"
         (opened)="panelOpened.emit()"
         [expanded]=expanded
    >

I have read How to comment HTML tag attribute in HTML source code? before posting my question. There is a solution for plain html attributes, but it's not working in Angular.


Solution

  • Looks like adding data- is the simplest solution. Thanks @Reactgular for this idea:

    <mat-expansion-panel
             data-ngIf="block"
             data-(opened)="panelOpened.emit()"
             data-[expanded]=expanded
        >