【发布时间】:2021-02-22 03:33:22
【问题描述】:
这是我要运行的代码:
<div [ngStyle]="getStartTimeStyle()" [ngSwitch]="event?.time">
Time: {{event?.time}}
<span *ngSwitchCase="'8:00 am'">(Early start)</span>
<span *ngSwitchCase="'10:00 am'">(Late Start)</span>
<span *ngSwitchDefault>(Normal Start)</span>
</div>
但它显示的错误如下:
错误 NG8002:无法绑定到“ngStyle”,因为它不是“div”的已知属性。
<div [ngStyle]="getStartTimeStyle()" [ngSwitch]="event?.time">
无法绑定到“ngSwitch”,因为它不是“div”的已知属性。
<div [ngStyle]="getStartTimeStyle()" [ngSwitch]="event?.time">
请帮忙,我该如何解决这个问题?
~~~~~~~~~~~~~~~~~~~~~~~~
【问题讨论】:
-
遵循一个具有正确模块导入的教程示例,例如通用模块
标签: angular angular-ngmodel ng-style