Angular: Empty Fiddle
http://angularjs.org/
by Danish Farman
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css">
<div ng-controller="MyCtrl">
<table class="table table-condensed">
<thead>
<tr>
<th>Id</th>
<th>Firstname</th>
<th>Lastname</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in items">
<td>{{item.id}}</td>
<td><input ng-model="item.firstName" ng-class="{ error: !item.firstName }"/></td>
<td><input ng-model="item.lastName" ng-class="{ error: !item.lastName }"/></td>
<td><input ng-model="item.email" ng-pattern="emailRegExp" ng-class="{ error: !item.email }"/></td>
<td><button ng-disabled="!item.lastName || !item.firstName || !item.email"/>Submit</td>
</tr>
</tbody>
</table>
</div>
CSS
.error{
color: red;
border-color:red;
}
JavaScript
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.items = [
{
id: 1,
firstName: 'Ivan',
lastName: 'Ivanov',
email: '[email protected]'
},
{
id: 2,
firstName: 'Petr',
lastName: 'Petrov',
email: '[email protected]'
}
];
$scope.emailRegExp = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
}