Here is a current example of my problem: http://jsfiddle.net/JSce5/3/
I'm trying to accept numbers from input fields in the view, then pass the values to the controller, run a calculation, then return the new value as a new variable name to the view. I'm new to AngularJS and I'm still trying to figure out how to do the basics here. Any help or insight would be very appreciated. Thanks!
<div ng-controller="MainCtrl">
Amount: <input type="number" ng-init="amountone=28" ng-model="amountone"> Value: <input type="number" ng-init="valueone=300" ng-model="valueone">
<br />
Amount: <input type="number" ng-init="amounttwo=3.5" ng-model="amounttwo"> Value: <input type="number" ng-init="valuetwo=50" ng-model="valuetwo">
<br /><br />
=========================
<br /><br />
Test ratio: {{ amountone }}/{{ amounttwo}} = {{ ratioone }}<br />
Test ratio: {{ amounttwo }}/{{ amountone}} = {{ ratiotwo }}<br />
</div>
====
'use strict';
var app = angular.module('myApp', []);
app.controller('MainCtrl', function ($scope) {
console.log($scope);
$scope.ratioone = $scope.amountone / $scope.amounttwo;
$scope.ratiotwo = $scope.amounttwo / $scope.amountone;
});