Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to do calculate area in website using Angular JS

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 598
    Comment on it

    Hello Reader's if you want to calculate the area of rectangle in your website. Then you have to choose Angular JS. Doing calculations in angular occur zero time delay. Lets see on example. In the example below page have two text boxes for entering the length and width of rectangle, Then it will show the area of that rectangle.

    <!DOCTYPE html>
    <html>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
    <body>
    <div ng-app="myApp" ng-controller="costCtrl">
    Quantity: <input type="number" ng-model="length">
    Price: <input type="number" ng-model="width">
    <p>Total = {{ (length* width) | area}}</p>
    </div>
    <script>
    var app = angular.module('myApp', []);
    app.controller('costCtrl', function($scope) {
        $scope.width= 1;
        $scope.length= 9.99;
    });
    </script>
    </body>
    </html>
    

    Output of the screen will generate two text boxes and result will be the multiplication of both input. And it's calculation will be the Area of rectangle.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: