SO - 30023195

by Arun P Johny

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.css">
<div ng-controller="AppController">
    <input type="hidden" name="Price" ng-init="Price=100;" ng-value="Price"/>
    <input type="text" name="Quantity" ng-model="Quantity" />
    Total Price:{{TotalPrice}}
    Quantity:{{Quantity}}
    Price:{{Price}}
    <button class="btn btn-primary btn-block" ng-click="click()">Add Items</button>
</div>

JavaScript

var app = angular.module('my-app', [], function () {
})

app.controller('AppController', function ($scope) {
    $scope.click = function(){
     $scope.TotalPrice = $scope.Price * $scope.Quantity;
    }
})