无法绑定到 'ngSwitchDefault',因为它不是 'ng-template' 的已知 属性

Can't bind to 'ngSwitchDefault' since it isn't a known property of 'ng-template'

我收到错误:

Can't bind to 'ngSwitchDefault' since it isn't a known property of 'ng-template'

在我继续之前:这是 不是

的副本

ngSwitchWhen 的绑定非常好,就像我使用它的方式一样。问题出在 ngSwitchDefault 上,我只能在它的语法建议版本 *ngSwitchDefault 中使用它。但是因为我有另一个关于这个问题的结构指令(*ngIf)我想使用 "Template-[ngSwitchDefault]"-Version,这给了我上述错误。

问题:为什么我可以使用 [ngSwitchCase] 而不能使用 [ngSwitchDefault]?

<div>
  <div *ngFor="let field of fields">
    <ng-container [ngSwitch]="field.myType">
      <ng-template [ngSwitchCase]="'something'">
        <div *ngIf="fieldIsVisibile[field.name]">
          Somthing special: {{field.name}}
        </div>
      </ng-template>

      <ng-template [ngSwitchDefault]>
        <div *ngIf="fieldIsVisibile[field.name]">
          Regular: {{field.name}}
        </div>
      </ng-template>
    </ng-container>
  </div>
</div>

我觉得应该是

<ng-template ngSwitchDefault>

因为 ngSwitchDefault 没有传递值并且没有 @Input()