Calculate with float values in widget

Hello
I have already created several user widgets. Is really a good way to adapt / expand openhab.
Now, when I press a key, I want to do an addition / subtraction and save the value in an item.

Basically this works very well, but I have not (yet) found any documentation on how I can perform float operations. This solution gives an error message.
The question is how do I calculate the Neuwert!
I would love to have a source for documentation so that I can develop myself thoroughly.

<div ng-if="itemValue('Minus') =='OFF'">
<button2 class="btn btn-lg" style="background: green; color: white"
var float Neuwert = Grenze_Diesel + 0.01
ng-click="sendCmd('Grenze_Diesel', itemValue('Neuwert'))">
It's off! Switch on
</button2>
</div>

THANK YOU

I have developed and tested the following solution

<h5  style="color:rgb(43, 189, 226)">Grenze E10 </h5>
<div style="color:greenyellow">Istwert: {{'%.03f' | sprintf:itemValue('Grenze_E10')}} 
</div>
<div oc-lazy-load="['/static/myangularPlus.js']">
<div1 ng-init = "clkcount =  itemValue('Grenze_E10')"</div1>   
<div ng-controller="ngclickCtrlPlus">
    <input style="background:cadetblue" type="button" style="cursor:pointer" value="Plus" ng-click ="getdetails()"/>
    <input style="background:cadetblue" "color:Red" type="button" style="cursor:pointer" value="setzen" ng-click ="sendCmd('Grenze_E10',clkcount)"/> <br></br>   
  	<span style="color:greenyellow">Sollwert: {{'%.03f' | sprintf:clkcount}}</span>
 </div> 
 </div>

and the java script

(function() {

'use strict';
angularmodule('app', [])controller('ngclickCtrlPlus', ['$scope', function($scope) {  
$scope.clkcount = parseFloat($scope.clkcount)
$scope.getdetails = function (clkcount) {  
$scope.clkcount = $scope.clkcount + parseFloat('0.01'); 
}}]); 
})
();

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.