Complete the code to use *ngSwitch on the variable 'color'.
<div [ngSwitch]="[1]"> <p *ngSwitchCase="'red'">Red selected</p> <p *ngSwitchCase="'blue'">Blue selected</p> <p *ngSwitchDefault>Other color</p> </div>
The [ngSwitch] directive should be bound to the variable that holds the value to switch on. Here, it is color.
Complete the code to display the message when the case is 'green'.
<p *ngSwitchCase="[1]">Green selected</p>
The value for *ngSwitchCase must be a string literal enclosed in single quotes inside the double quotes.
Fix the error in the *ngSwitchCase to correctly check for the number 1.
<p *ngSwitchCase="[1]">Number one selected</p>
When switching on a number, the case value should be the number itself without quotes.
Fill both blanks to switch on 'status' and check for 'active' case.
<div [ngSwitch]="[1]"> <p *ngSwitchCase=[2]>Active status</p> <p *ngSwitchDefault>Inactive or unknown</p> </div>
The [ngSwitch] binds to the variable status. The case for 'active' must be a string literal with single quotes inside the template.
Fill all three blanks to switch on 'mode', check for 'edit' case, and display the message.
<section [ngSwitch]="[1]"> <div *ngSwitchCase=[2]>[3]</div> <div *ngSwitchDefault>View mode</div> </section>
The switch binds to mode. The case for 'edit' uses single quotes. The displayed message is 'Editing content'.