Skip to content

Commit

Permalink
Update trafficlight.component.ts for Angular 17 (#214)
Browse files Browse the repository at this point in the history
* Update trafficlight.component.ts for Angular 17

Updated traffic light example for newest production version of Angular.

* Update trafficlight.component.ts

Fixed unclosed switch statement
  • Loading branch information
Joshibbotson committed Jan 26, 2024
1 parent 58fe4e7 commit dadc9ed
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ const TRAFFIC_LIGHTS = ["red", "orange", "green"];
<p>Light is: {{ light }}</p>
<p>
You must
<ng-container [ngSwitch]="light">
<span *ngSwitchCase="'red'">STOP</span>
<span *ngSwitchCase="'orange'">SLOW DOWN</span>
<span *ngSwitchCase="'green'">GO</span>
</ng-container>
@switch (light) {
@case("red") {
<span>STOP</span>
}
@case("orange") {
<span>SLOW DOWN</span>
}
@case("green") {
<span>GO</span>
}
}
</p>
`,
})
Expand Down

0 comments on commit dadc9ed

Please sign in to comment.