I have some variable which I display just a text and have two buttons to increase or decrease it. I need to set max and min value can go that way. There are a lot of examples for input fields & range filters but I can't figure out how to adapt it to my case (JS/Angular noob here, sorry).
<script type="text/javascript">
var airApp = angular.module('airApp', []);
airApp.controller('dataShow', function($scope, $http, $filter) {
$scope.init = function() {
$scope.temp = +23.0; // Will be $http.request actually
}
});
</script>
And this HTML:
<div class="container" align="center">
<div class="page-header">
<h1>Control</h1>
</div>
<div ng-app="airApp" ng-controller="dataShow" ng-init="init()" class="panel-body">
<h1>
{{temp > 0 ? '+' : ''}}{{temp | number : 1}}
<button name="plus" ng-click="temp = temp + 0.5" class="btn btn-primary">+</button>
<button name="minus" ng-click="temp = temp - 0.5" class="btn btn-primary">-</button>
</h1>
</div>
</div>
How to limit this for example to a -10 to +30 range?