Use this code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<script type="text/javascript">
var flgIsHide = false;
function controller1($scope) {
$scope.items = [{ id: 1, name: "Item-1", imgurl: "http://icons.iconarchive.com/icons/hopstarter/flag/256/India-icon.png", isSelected: false },
{ id: 2, name: "Item-2", imgurl: "http://flagspictures.org/photo/icons/normal/256/India.png", isSelected: false },
{ id: 3, name: "Item-3", imgurl: "https://cdn1.iconfinder.com/data/icons/REALVISTA/flags/png/400/India.png", isSelected: false },
{ id: 4, name: "Item-4", imgurl: "http://www.swingdanceamerica.com/uploads/1/4/1/1/14116467/7085937.jpg", isSelected: false}];
$scope.selectedItemImage = "#";
$scope.selectItem = function (id, url) {
flgIsHide = false;
$scope.selectedItemImage = url;
$scope.items.forEach(function (item) {
if (item.id == id)
item.isSelected = true;
else
item.isSelected = false;
});
};
$scope.safeApply = function (fn) {
var phase = this.$root.$$phase;
if (phase == '$apply' || phase == '$digest') {
if (fn && (typeof (fn) === 'function')) {
fn();
}
} else {
this.$apply(fn);
}
};
}
window.onclick = function () {
if (flgIsHide) {
var scope = angular.element(document.getElementById('controller1')).scope();
scope.safeApply(function () {
scope.items.forEach(function (item) {
item.isSelected = false;
});
scope.selectedItemImage = "#";
});
}
else
flgIsHide = true;
}
</script>
</head>
<body ng-app>
<div id="controller1" ng-controller="controller1">
<div>
List Of Items</div>
<table style="border-collapse: collapse;" border="1">
<tr>
<td style="vertical-align: top;">
<table>
<tr ng-repeat="item in items">
<td ng-style="{'background-color': item.isSelected==false?'Red':'green'}">
<button ng-click="selectItem(item.id,item.imgurl)">
{{item.name}}</button>
</td>
</tr>
</table>
</td>
<td>
<div ng-show="selectedItemImage!='#'">
<img id="imgItem" ng-src="{{selectedItemImage}}" style="height: 300px; width: 300px;" />
</div>
</td>
</tr>
</table>
</div>
</body>
</html>