在 Angular html 模板中注释掉单个指令或 属性
Comment out a single directive or property in Angular html template
在这个例子中,有没有办法注释掉带有 *ngIf
、(opened)
、[expanded]
的行?
<mat-expansion-panel
*ngIf="block"
(opened)="panelOpened.emit()"
[expanded]=expanded
>
我在发布问题之前已阅读 How to comment HTML tag attribute in HTML source code?。普通 html 属性有一个解决方案,但它在 Angular 中不起作用。
看起来添加 data-
是最简单的解决方案。感谢 @Reactgular 提出这个想法:
<mat-expansion-panel
data-ngIf="block"
data-(opened)="panelOpened.emit()"
data-[expanded]=expanded
>
在这个例子中,有没有办法注释掉带有 *ngIf
、(opened)
、[expanded]
的行?
<mat-expansion-panel
*ngIf="block"
(opened)="panelOpened.emit()"
[expanded]=expanded
>
我在发布问题之前已阅读 How to comment HTML tag attribute in HTML source code?。普通 html 属性有一个解决方案,但它在 Angular 中不起作用。
看起来添加 data-
是最简单的解决方案。感谢 @Reactgular 提出这个想法:
<mat-expansion-panel
data-ngIf="block"
data-(opened)="panelOpened.emit()"
data-[expanded]=expanded
>