フロントエンドエンジニア芸人もりたけんじのAngular2とTypeScriptのお勉強

【Angular2】これ。Error: Template parse errors: Can’t bind to ‘ngSwitchDefault’ since it isn’t a known property of ‘div’. (“

Error: Template parse errors:
Can’t bind to ‘ngSwitchDefault’ since it isn’t a known property of ‘div’. (“

Angular2でコンソールに出てくるエラーは優しい。かなり丁寧に出力してくれる。

【Angular2】これ。Error: Template parse errors: Can't bind to 'ngSwitchDefault' since it isn't a known property of 'div'. ("

【Angular2】これ。Error: Template parse errors: Can’t bind to ‘ngSwitchDefault’ since it isn’t a known property of ‘div’. (“

////An error occurs
<div [ngSwitch]="valueswitch">
  <div *ngSwitchCase="'case1'">red</div>
  <div *ngSwitchCase="'case2'">yellow</div>
  <div *ngSwitchDefault="'case2'">green</div>
</div>

/////fix
<div [ngSwitch]="valueswitch">
  <div *ngSwitchCase="'case1'">red</div>
  <div *ngSwitchCase="'case2'">yellow</div>
  <div *ngSwitchDefault>green</div>
</div>

ngSwitch

しょうもないエラーを記事にしてすみませんでした。

(Visited 1 times, 1 visits today)