How should the number 1 be treated when the decimals are zero, for example 1.000? In this case, an alert popup should appear indicating that the numbers are the same. The maximum length of the textbox should be 7 characters.
For instance, 1 and 1.00000001 should be considered different.
Also, the numbers 1 and 1.01 should be viewed as different. For example, if we have the numeric value 1 and the numeric value 1 with any decimal number.
If the number is 1.00 and another number is 1.01, 1.001, or any decimals after the number, they should be seen as different values.
Below is a snippet of sample code:
<!doctype html>
<html ng-app>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<div ng-controller="Ctrl">
<input type="text" ng-model="contractDetailsScreen.percent" maxlength="7" numbers-only="numbers-only" />
<button ng-click="actionme()">click</button>
</div>
</body>
</html>
function Ctrl($scope) {
$scope.actionme = function(){
if($scope.contractDetailsScreen.percent){
alert('The values are the same');
}
else{
alert("The values are different");
}
};
}