Wednesday, 21 October 2020

AJS13

<html>

 <head> <script src="angular.min.js"></script></head>

 

<body ng-app="mainApp" ng-controller="studentController">

<center>

 <h2 style=color:Red;>Student Marksheet Program</h2>

 <div>

<form name="f1">

<table border="1">

 <!-- ng-model-Binds HTML control's value to a property on the $scope object-->

<tr>

<td>Enter roll number</td>

<td><input type="number" ng-model="rollno"></td>

</tr>

 <tr>

<td>Enter student name: </td>

<td><input type="text" name="sname" ng-model="studName"></td>

</tr>

 <tr>

<td>Enter Class </td>

<td><input type="text" name="sclass" ng-model="class1"> </td>

</tr>

 <tr>

<td>Enter Subject1 Marks</td>

<td> <input type="number" name="subject1" ng-model="sub1"></td>

</tr>

 <tr>

<td>Enter Subject2 Marks</td>

<td> <input type="number" name="subject2" ng-model="sub2"></td>

</tr>

 <tr>

<td>Enter Subject3 Marks</td>

<td> <input type="number" name="subject3" ng-model="sub3"></td>

</tr>

 <tr>

<td> <input type="button" value="Display Result" ng-click="isShowHide('show')">

</td>

</tr>

 </table>

</form>

</div>

 <div ng-show="showval" >

<br><br>

<h1 style=color:green;>Mark Sheet of Student</h1>

<form name="f2" ng-controller="studentController">

<table border="2">

<thead>

<td>Rollno</td>

<td>Name</td>

<td>Class</td>

<td>Subject1</td>

<td>Subject2</td>

<td>Subject3</td>

<td>Total</td>

<td>Percentage</td>

<td>Grade</td>

</thead>

  <!-- ng-model-(name used)-->

<tr>

<td>{{rollno}}</td>

<td>{{studName}}</td>

<td>{{class1}}</td>

<td>{{sub1}}</td>

<td>{{sub2}}</td>

<td>{{sub3}}</td>

<td>{{sub1 + sub2 + sub3}}</td>

<td>{{(( sub1+sub2+sub3)/300)*100;}}</td>

<td><input type="text" name="grade" ng-model="grade"></td>

</tr>

</table>

 </form>

</div>

 <script>

var mainApp = angular.module("mainApp", []);

mainApp.controller('studentController', function ($scope) {

 $scope.showval=false;

 $scope.isShowHide = function (param) {

if (param=="show") {

$scope.showval = true;

}

 if($scope.per=74 && $scope.per<=100)

$scope.grade="A";

else if($scope.per=60 && $scope.per<74)

$scope.grade="First";

else if($scope.per>=45 && $scope.per<59)

$scope.grade="Second";

else if($scope.per>=35 && $scope.per<45)

$scope.grade="Pass";

else

$scope.grade="fail";

}

});

</script>

</center>

</body>

 </html>