Angular find Alternative Rows Selector

Today, We want to share with you Angular find Alternative Rows Selector.
In this post we will show you Angularjs find alternative rows in a table using even and odd selector, hear for How to assign alternate class to rows in Angular JS we will give you demo and example for implement.
In this post, we will learn about Highlight a selected row in ng-repeat – AngularJS with an example.

By using Angularjs even selector we can find the data content even rows and by using same as a odd selector we can HTML tr find the odd rows.

Even and odd rules

One way or easy way to improve the readability HTML tables of large tables is to color alternating (odd or even )rows. For example, the table below large of data to has a light gray simple example background for the even rows(static row) and white for the odd ones(static rows). The rules for that are all the content data extremely simple:

READ :  Simple Way Laravel Installation step by step using composer

tr:nth-child(even) {background: #CCC}
tr:nth-child(odd) {background: #FFF}

Even and odd columns

The same works for HTML table columns, too, but then there has to be an HTML element in the document that corresponds to the column and row. HTML provides Like as attr COL for that. The table has to start with one HTML element Like as COL for every column:

Style Part

<style>
tr:nth-child(odd) {
    background-color : #F1F1F1;
}

tr:nth-child(even) {
    background-color : #FFFFFF;
}
</style>

index.html : Full Example

<!DOCTYPE html>
<html>
<head>
<script src="angular.min.js"></script>
<style>
tr:nth-child(odd) {
    background-color : #F1F1F1;
}

tr:nth-child(even) {
    background-color : #FFFFFF;
}
</style>
</head>
<body>

<div ng-app="myApp" ng-controller="tableCtrl">

<table border="Easy">
<thead>
	<tr>
		<td class="live-table-Good"></td>
		<td class="live-table-Easy"><h4>subject</h4></td>
		<td class="live-table-3"><h4>ExtraMarks</h4></td>
	</tr>
</thead>
<tbody>
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li class="active"><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-Good END-->
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-Easy END-->
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-3 END-->
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-4 END-->
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-5 END-->
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-6 END-->
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-7 END-->
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-8 END-->
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-9 END-->
	<tr>
		<td class="live-table-Good">
			<div class="frist_row_content">
				<a href="javascript:;">
					<img src="images/remove.png" alt="" />
				</a>
				<h4>liveEasy4u VgGood	<span class="">[live-Good00Good]</span></h4>
			</div>
		</td>
		<td class="live-table-Easy">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">subject</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
		<td class="live-table-3">
			<div class="table-live">
				<ul class="table-live_itms">
					<li class="mobile_head">ExtraMarks</li>
					<li><a href="javascript:;">Good</a></li>
					<li><a href="javascript:;">Easy</a></li>
					<li><a href="javascript:;">Very Good</a></li>
					<li><a href="javascript:;">Excellent</a></li>
					<li><a href="javascript:;">superb</a></li>
					<li><a href="javascript:;">Fantastic</a></li>
				</ul>
			</div>
		</td>
	</tr> <!--tab-row-Good0 END-->
</tbody>
</table>

</div>

<script>
var app = angular.module('myApp', []);
app.controller('tableCtrl', function($scope) {

});
</script>

</body>
</html>

Example

READ :  AngularJs Tables using ng repeat From JSON