Tuesday, 8 December 2020

AJS16

 

<html>

 <head>

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

<script>

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

app.controller('studCtrl', ['$scope', function ($scope) {

$scope.showStudent = function () {

$scope.stud = [

{ name: 'Amit', city: 'pune' },

{ name: 'Sumit', city: 'pune' },

{ name: 'Rahul', city: 'mumbai' },

{ name: 'sachin', city: 'mumbai' },

];

}

}]);

 

</script>

</head>

 

<body ng-app="myApp" ng-controller="studCtrl">

<form>

<div ng-controller="studCtrl">

List of students living in pune<br>

<table border="2">

<tr ng-repeat="x in stud | filter:'pune'">

<td>{{x.name}}</td>

<td>{{x.city}}</td>

</tr>

</table>

 

</div>

 

</div>

<input type="button" ng-click="showStudent()" value="Click Here"> </button>

</form>

 

</body>

 

</html>