Use [ngValue] instead of "value":
<select [(ngModel)]="selected.isConnected" id="etat">
    <option [ngValue]="0">Not connected</option>
    <option [ngValue]="1">Connected</option>
</select> 
    If you want cast it within formChanged() method (Which you haven't provided yet). You should use + symbol as shown below,
formChanged(): void {
    selected.isConnected = +selected.isConnected;
    ...
}
    No, sadly you're forced to parse it on your own in the formChanged() method, since you always get a string back from the select.
You could try it with something like this:
formChanged(): void {
    selected.isConnected = parseInt(selected.isConnected);
    // ...
}
    
                If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With