Maintain calculated relationship between input fields with AngularJS

Size
2,393 Kb
Views
12,144

How do I make an maintain calculated relationship between input fields with angularjs?

Performs conversion between Fahrenheit, Celsius, and Kelvin on update without circular watches.. What is a maintain calculated relationship between input fields with angularjs? How do you make a maintain calculated relationship between input fields with angularjs? This script and codes were developed by Edward R Haase on 13 January 2023, Friday.

Maintain calculated relationship between input fields with AngularJS Previews

Maintain calculated relationship between input fields with AngularJS - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Maintain calculated relationship between input fields with AngularJS</title> <script src="https://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'>
</head>
<body>
<div class="container" ng-app="app" ng-controller="MyCtrl"> <div class="input-group"><span class="input-group-addon">F</span> <input type="number" ng-model="f" ng-click="c=ftocr(f);k=ftokr(f)" ng-keyup="c=ftocr(f);k=ftokr(f)"/> </div> <div class="input-group"><span class="input-group-addon">C</span> <input type="number" ng-model="c" ng-click="f=ctofr(c);k=r(ctok(c))" ng-keyup="f=ctofr(c);k=r(ctok(c))"/> </div> <div class="input-group"><span class="input-group-addon">K</span> <input type="number" ng-model="k" ng-click="f=r(ktof(k));c=r(ktoc(k))" ng-keyup="f=r(ktof(k));c=r(ktoc(k))"/> </div> <pre>{{f}}, {{c}}</pre>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap-tpls.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Maintain calculated relationship between input fields with AngularJS - Script Codes JS Codes

var app = angular.module('app', []);
function r(v) { return Math.round(v*100) / 100;
}
app.controller('MyCtrl', ['$scope', function($scope) { angular.extend($scope, { r:r, // rounding on scope ftocr: function(f) { return r($scope.ftoc(f)); }, ftoc: function(f) { return (f - 32) / 1.8; }, ctofr: function(c) { return r($scope.ctof(c)); }, ctof: function(c) { return (c * 1.8) + 32; }, ftokr: function(f) { return r( ((f-32)/1.8)+273.15 ); }, ktof: function(k) { return ((k - 273.15)*1.8)+32; }, ktoc: function(k) { return k - 273.15; }, ctok: function(c) { return c + 273.15; } });
}]);
Maintain calculated relationship between input fields with AngularJS - Script Codes
Maintain calculated relationship between input fields with AngularJS - Script Codes
Home Page Home
Developer Edward R Haase
Username ehaase
Uploaded January 13, 2023
Rating 3
Size 2,393 Kb
Views 12,144
Do you need developer help for Maintain calculated relationship between input fields with AngularJS?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Edward R Haase (ehaase) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!