Angular JS

Automatic currency conversion

by Vico Bertogli III

HTML

<div ng-app="myApp" ng-controller="costCtrl">

<input type="number" ng-model="quantity">
<input type="number" ng-model="price">

<p>Total = {{ (quantity * price) | currency }}</p>

</div>

SCSS

* {
    text-align:Center;
}

div[ng-app="myApp"] {
    padding:15px;
    
    p {
        margin-top:15px;
    }
}

JavaScript

var app = angular.module('myApp', []);
app.controller('costCtrl', function($scope) {
    $scope.quantity = 1;
    $scope.price = 9.99;
});