<DOCTYPE html>
<html>
<head>
<meta CHARSET="UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body ng-app="myApp">
<h2>Controller</h2>
<fieldset>
<legend>
Circle
</legend>
<div ng-controller="Circle">
Radius = {{radius}} <br/>
Diameter = {{diameter}} <br/>
Area = {{area}} <br/>
Circumference = {{circumference| number:2}} <br/>
</div>
</fieldset>
<fieldset>
<legend>
Rectangle
</legend>
<div ng-controller="Rectangle">
Length = {{length}} <br/>
Breadth = {{breadth}} <br/>
Area = {{area}} <br/>
Circumference = {{circumference| number:2}} <br/>
</div>
</fieldset>
</body>
<script>
var app = angular.module("myApp", []);
app.controller("Circle", function ($scope) {
$scope.radius = 5;
$scope.diameter = $scope.radius * 2;
$scope.area = 3.14 * $scope.radius * $scope.radius;
$scope.circumference = 2 * 3.14 * $scope.radius;
});
app.controller("Rectangle", function ($scope) {
$scope.length = 5;
$scope.breadth = 6;
$scope.area = $scope.length * $scope.breadth;
$scope.circumference = 2 * $scope.length * $scope.breadth;
});
</script>
</html>