AngularJS 1.4
by dimskraft
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.min.js"></script>
<body ng-app="myApp">
<div ng-controller="MyController">
Petameters:<input type="text" ng-model="petameters"><br/>
Light years:<input type="text" ng-model="lightyears"><br/>
Parsecs:<input type="text" ng-model="parsecs"><br/>
</div>
</body>
JavaScript
var myApp = angular.module('myApp', ['myControllers']);
var myControllers = angular.module('myControllers', []);
myControllers
.controller('MyController', ['$scope', function ($scope) {
$scope.petameters = 10;
$scope.lightyears = $scope.petameters / 9.460730472580800;
$scope.parsecs = $scope.lightyears / 3.2616;
}]);