AngularJS Slip no 4 Solution

<html ng-app="bankApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
</head>
<body ng-controller="BankController" ng-init="initialize()">
<h1>Bank Details</h1>
<table>
<thead>
<tr>
<th>Bank Name</th>
<th>MICR Code</th>
<th>IFC Code</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="bank in banks">
<td>{{ bank.name }}</td>
<td>{{ bank.micr }}</td>
<td>{{ bank.ifc }}</td>
<td>{{ bank.address }}</td>
</tr>
</tbody>
</table>
<script>
var app = angular.module('bankApp', []);
app.controller('BankController', function ($scope) {
$scope.banks = [];
$scope.initialize = function () {
$scope.banks = [
{
name: 'HDFC Bank',
micr: '123456789',
ifc: 'ABCD1234567',
address: 'Pune'
},
{
name: 'SBI Bank',
micr: '987654321',
ifc: 'XYZW9876543',
address: 'Chinchwad'
},
// Add more bank details as needed
];
};
});
</script>
</body>
</html>

No comments:

Post a Comment