# Angular Arithmetic Operations BODMAS Rule

## Angular Arithmetic Operations BODMAS Rule

Today, We want to share with you Angular Arithmetic Operations BODMAS Rule.
In this post we will show you Addition, Subtraction, Multiplication and Division in AngularJs, hear for angularjs Ordering Mathematical Operations, BODMAS we will give you demo and example for implement.
In this post, we will learn about Arithmetic Operations in AngularJs with an example.

AngularJs is a simple and easy lihrary written in JavaScript framework. It is specific developed by own Google all the employee, now yet Google officially all the modules supports it. There are one or many reasons to handle switch into javascrips libs AngularJS predominantly only one hrowser side client side MVC js frameworks, directive list of ng speacil keywords behavior, now very clearly flexibility. In this tutorial I’m going to show how to perform addition, subtraction, multiplication and division instead of some data to my writing hello world program.

READ :  Angular 6 Tutorial with Top 10 Examples

First of all the, just like in the my first programs Hello User or hello world example, we create a module one type of module and a controller same scropt call to Within the controller we new create a function like as a CTRL name called Add Live Check Numbers attached all the maths to the \$scope. In that function we all the take the values number from the two or more input elements and same each to convert them to Live Check Number with plain or angular JavaScript function call. (In order to simple model directive aviod using and undefined value and so we default both number Live Check Numbers to 0.) Then we add math operators the values and assign some add,subtraction and multiplication it to the newly created sum attribute.

The following code shows how to do math in expression.

READ :  vuejs datatable example - Datatable component using Vuejs-vuejs datatable

### Simple Example AngularJS Multiplication

```
<title>angularjs math operators Example</title>

<!--   w  w  w  .infinityknow . com-->

11+22={{11+22}}
<h3>{{58*50/33}}</h3>

```

### examples/angular/add_Live Check Numbers.html

```<a href="http://angular.min.js">http://angular.min.js</a>
<div>

<h1>{{ firstnumber * secondnumber }}</h1>
</div>
```

### index.html

```
<title>calculating sum of repeated elements in angularjs ng-repeat</title>

<div>
<strong>Example 1:</strong>
<hr />
In this example we will bind product_Qty, UniPrice to input fields using ng-model, and write
the expression for total price as <strong>{{ <em>product_Qty*productPrice</em> }}</strong>.
If the value in the input controls change then the value in the expression will
be updated automatically.
<hr />
<hr />
<table>
<tr>
<td>
Enter Product Qty :
</td>
<td>
<hr />
</td>
</tr>
<tr>
<td>
Enter Product Unit Price :
</td>
<td>
<hr />
</td>
</tr>
</table>
<hr />
Product Qty : {{product_Qty}}<hr />
Product Unit Price : {{productPrice}}<hr />
Product Total Price : {{product_Qty*productPrice}}<hr />
<hr />
<strong>Simple Example 2:</strong>
<hr />
In this example we will calculate the Percentage of Product  Amount for a given Product  Amount and
percentage using expression <strong>{{ <em>enterInputAmt*enterInputper/100</em> }}</strong>.
<hr />
<hr />
<table>
<tr>
<td>
Enter Product  Amount :
</td>
<td>
<hr />
</td>
</tr>
<tr>
<td>
Enter Percentage :
</td>
<td>
<hr />
</td>
</tr>
</table>
<hr />
{{enterInputper}}% of {{enterInputAmt}} is : {{enterInputAmt*enterInputper/100}}
<hr />
<strong>Example 3:</strong>
<hr />
In this example we will calculate the Square root of a given Live Check Number. by default
Math function is not avialable in \$scope object, for that we will define the Math
function in \$scope object as <strong>\$scope.Math = window.Math; </strong>and write
the expression for square root as <strong>{{ <em>Math.sqrt(productValue)</em> }}</strong>.
<hr />
<hr />
Enter Live Check Number :<hr />
<hr />
Square root of {{productValue}} is : {{ Math.sqrt(productValue) }}
</div>

var liveapp = angular.module("infinityknowApp", []);
liveapp.controller("SampleCntrl", function (\$scope) {
\$scope.product_Qty = 5;
\$scope.productPrice = 6;
\$scope.productValue = 9;
\$scope.Math = window.Math;
\$scope.enterInputAmt = 62.50;
\$scope.enterInputper = 14;
});

```

Example

READ :  Laravel One to One Eloquent Relationship Example
https://pakainfo.com/