File Name: Script.js in Scripts folder.
/// <reference path="angular.min.js" />
var myApp = angular.module("myModule", []);
var myController = function ($scope)
{
var Employee = [
{
Name: "Raj", Gender: "Male", Address: "Pune", AccountNo:2356574
},
{
Name: "Shiva", Gender: "Male", Address: "Pune", AccountNo: 2746579
},
{
Name: "Mili", Gender: "Female", Address: "US", AccountNo: 9234650
},
{
Name: "Divya", Gender: "Female", Address: "Nagpur", AccountNo: 9234697
},
{
Name: "Digvijay", Gender: "Male", Address: "Pune", AccountNo: 1234607
}
];
$scope.Emp = Employee;
};
myApp.controller("myCont", myController);
<!DOCTYPE html>
<html ng-app="myModule">
<head>
<script src="Scripts/angular.min.js" type="text/javascript"></script>
<script src="Scripts/Script.js"></script>
<style>
table, th, td
{
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd)
{
background-color: #ffe6e6;
}
table tr:nth-child(even)
{
background-color: #ccffcc;
}
</style>
</head>
<body style="font-family:Arial; font-size:medium; color:darkblue">
<div ng-controller="myCont">
<h3>ngHide and ngShow directive in AngularJS.</h3>
<br/>
<input type="checkbox" ng-model="hideAccountNo"/>Hide Account Number
<br/>
<br/>
<table>
<tr>
<th>EmpName</th>
<th>Gender</th>
<th>Address</th>
<th ng-hide="hideAccountNo">AccountNo</th>
</tr>
<tr ng-repeat="e in Emp">
<td>{{e.Name}}</td>
<td>{{e.Gender}}</td>
<td>{{e.Address}}</td>
<td ng-hide="hideAccountNo">{{e.AccountNo}}</td>
</tr>
</table>
</div>
</body>
</html>
<table>
<tr>
<th>EmpName</th>
<th>Gender</th>
<th>Address</th>
<th ng-hide="hideAccountNo">AccountNo</th>
<th ng-show="hideAccountNo">AccountNo</th>
</tr>
<tr ng-repeat="e in Emp">
<td>{{e.Name}}</td>
<td>{{e.Gender}}</td>
<td>{{e.Address}}</td>
<td ng-hide="hideAccountNo">{{e.AccountNo}}</td>
<td ng-show="hideAccountNo">********</td>
</tr>
</table>