JSFiddle - React, Tailwind, and code Playground
by Alan Doe
HTML
<div ng-app , ng-controller="restau">
<div ng-repeat="res in restaurants" ng-class="{selected: $index==selectedIndex}" ng-click="selectRow($index)">
<p>{{res.name}}</p>
<p>{{res.rating}}</p>
</div>
</div>
CSS
.selected
{
background-color:lightgreen;
}
JavaScript
function restau($scope,$location)
{
$scope.restaurants = [{name:'arkham', rating:5},{name : 'euler',rating:10}];
alert(JSON.stringify($location));
$scope.selectRow = function(row)
{
alert('select row' + row);
$scope.selectedIndex = row;
}
}