Hi,
I have one textbox Duration
if duration is greater than 9 need to display validation message at relevant line.
could you please help me
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Index</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', [])
app.controller('MyController', function ($scope, $http, $window) {
$scope.Details = [{ Name: 'mahesh' }];
$scope.IsValid = true;
$scope.IsExist = false;
$scope.GetMaxLength = function (timesheet, index) {
if (timesheet.Duration != null) {
if (timesheet.Duration > 0 && timesheet.Duration <= 9) {
}
else {
$scope.IsValid = false;
$scope.IsExist = true;
}
}
else {
$scope.IsValid = true;
$scope.IsExist = false;
}
}
});
</script>
</head>
<body ng-app="MyApp" ng-controller="MyController">
<table id="tblOrders" class="table table-responsive">
<tr>
<th>Name</th>
<th>Duration</th>
</tr>
<tbody ng-repeat="detail in Details">
<tr>
<td><input type="text" ng-model="detail.Name" /></td>
<td>
<input type="text" ng-model="detail.Duration" ng-change="GetMaxLength(detail,$index)" />
</td>
</tr>
</tbody>
</table>
</body>
</html>