Monday, 23 November 2020

AJS19

 

<html>

 <head>

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

<script>

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

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

 $scope.showEmployee = function () {

$scope.emp = [

{ name: 'Archana', city: 'Pune',salary:'50000' },

{ name: 'Adhira', city: 'Delhi',salary:'60000' },

{ name: 'Akira', city: 'Mumbai',salary:'70000' },

{ name: 'Abira', city: 'Pune',salary:'80000'},

];

}

}]);

 

</script>

</head>

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

<form>

<div ng-controller="empCtrl">

List of employees order by salary<br>

<table border="2">

<tr ng-repeat="x in emp| orderBy:'salary'">

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

<td>

{{x.city}}

</td>

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

</tr>

</table>

 </div>

<br>

<br>

<br>

<br>

 </div>

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

</form>

 </body>

 </html>