I am currently working with Ionic2 and Angular2 and encountering an issue while trying to implement a segment using ngSwitchWhen
. Unfortunately, the functionality is not working as expected and I am receiving an error message.
How can I resolve this issue? What may be causing it to not work properly?
Below is the error message that appeared:
https://i.sstatic.net/JXO5g.png
<ion-toolbar>
<ion-segment [(ngModel)]="menuSelect" color="important">
<ion-segment-button value="light">
Light
</ion-segment-button>
<ion-segment-button value="sensor">
Sensor
</ion-segment-button>
</ion-segment>
</ion-toolbar>
<ion-content [ngSwitch]="menuSelect">
<!--func+ - light-->
<ion-item *ngSwitchWhen="'light'">
<ion-list>
<ion-list-header>
<ion-label>On/Off</ion-label>
<ion-toggle (click)="toggleLight()"></ion-toggle>
</ion-list-header>
</ion-list>
<!--light-off-->
<div [hidden]="lightOn">
<div class="light-off">Please turn on the light.</div>
</div>
<!--light-on-->
<div [hidden]="!lightOn">
<ion-list>
<ion-list-header class="title">
Color
</ion-list-header>
</ion-list>
<ion-list>
<ion-list-header class="title">
Brightness
<ion-badge>{{brightness}}</ion-badge>
</ion-list-header>
<ion-item>
<ion-range min="0" max="5" step="1" snaps="true" [(ngModel)]="brightness">
<ion-icon range-left small name="sunny"></ion-icon>
<ion-icon range-right name="sunny"></ion-icon>
</ion-range>
</ion-item>
</ion-list>
</div>
</ion-item>
<!--func+ - sensor-->
<ion-item *ngSwitchWhen="'sensor'">
<ion-list>
<ion-list-header>
<ion-label>On/Off</ion-label>
</ion-list-header>
</ion-list>
</ion-item>
</ion-content>