Angular & Math Pow in filters
by Arnaud
HTML
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script>
<div ng-app="app">
<div ng-controller="Ctrl">
<form>
<div class="item">
<label>Capital</label>
<input type="range" id="loan" name="loan" ng-model="capital" min="10000" max="1000000" step="10000" value="10000">
<h1>{{capital}}</h1>
</div>
<hr>
<div class="item">
<label>Number of years</label>
<input type="range" id="duree" name="duree" ng-model="time" min="0" max="60" step="5" value="1">
<h1>{{time}}</h1>
</div>
<hr>
<div class="item">
<label>rate %</label>
<input type="range" id="duree" name="rate" ng-model="rate" min="1" max="15" step="0.1" value="1">
<h1>{{rate}}</h1>
</div>
<div class="item">
<h1>Monthly payment : {{((capital * (rate /1200) * (time / 12))/12) + (capital / time) | number:2 }}</h1>
<h2 >
</h2>
</div>
</form>
</div>
</div>
CSS
m = Monthly payment
K = Kapital
R = Rate %
n = Period of payement, in years
m = [( K * R ) / 12] / [ 1 - ( 1 + ( R / 12 )) ^-n]*12
For 1000000 capital, 60 years and 5% rate, the answer should be 4386.42
JavaScript
var app = angular.module('app', []);
function Ctrl($scope) {
$scope.Math = window.Math;
};