0% found this document useful (0 votes)
6 views1 page

AngularJS Calculator Example

The document contains HTML and AngularJS code for a simple calculator application. It defines a module and a controller to perform basic arithmetic operations such as addition, subtraction, multiplication, and division. The user interface includes input fields for two numbers and buttons to trigger the operations, displaying the result on the page.

Uploaded by

Súbàsh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

AngularJS Calculator Example

The document contains HTML and AngularJS code for a simple calculator application. It defines a module and a controller to perform basic arithmetic operations such as addition, subtraction, multiplication, and division. The user interface includes input fields for two numbers and buttons to trigger the operations, displaying the result on the page.

Uploaded by

Súbàsh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

E Untitled-1 index.

html Cleaip indexhtmi CAr4 X


MaximumTestjava 2
cUsers Kannan > Desktop ex-4 o indexhtml h t m l body >G [Link] centerbr
<html>
2
chead
*
<script srce"[Link]
<Script>
var app-angular. module('calculator", []):
[Link]("calcontrol',function($scope)
$[Link]-'e';
[Link]-function(ch)

switch(ch)
2

case +
14 $scope. result-$[Link]$scope. b;
break;
L6 case

$scope. result-$scope.a-$scope.b;
break;
9 case "**:

$scope. result-$scope. a"$scope.b;


break;
2 case ' :
$scope. result-$scope.a/$scope. b;
4 break;

/Script
</head
30 <body
<div class="cal" ng-app-"calculator" ng-controller "calcontro1"
<center>

33 <input type-"number" ng-model-"a" placeholder="First Number" <br>cbr>


4 <input type="number ng-nodel-"b" placeholder= "Second Number" <br> <br>
35
<input type-"submit value-+ ng-click="operator(+)><br>cbr>
<input type="submitvalue-ng-click="operator(-)><br> <br>
<input type-"submit" value-"** ng-click-"operator( **)"cbr>cbr>
8 <input type="submit" value="/" ng-click="operator(/")"><br><br>
input type-"submit" value-"({result}}">
/center>
41 /div>
2
43
/body
/html>

You might also like