In my application, I have defined an interface:
export interface Channel {
canal: string;
name: number;
status: string;
temperature: number;
setpoint: number;
permission: boolean;
percentOut: number;
}
[UPDATE] in the HTML file:
<input type="range" #inputRange min="5" max="30" value="channel.setPoint" step="0.5" class="slider" (change)= "putSetpoint(channel, inputRange.value)">
In the home.ts file:
putSetpoint(cb: Channel, value: number){
console.log(value);
cb.setpoint = value;
this.homedata.setpointChannel(cb);
console.log('setpoint call');
}
Next, I create a JSON object to send to the server:
setpointChannel(cb: Channel) {
var chanObj = {
channels : {
canal: cb.canal,
setPoint: cb.setpoint,
name: cb.name,
}
};
console.log(chanObj);
}
However, the rendered JSON for setpoint is returned as a string:
channels: {canal: 0, setPoint: "21", name: "chambre"}