This might will help you ...
<html ng-app="myNoteApp">
<head>
<title>My Notepad with Char limit</title>
<script>
var app = angular.module("myNoteApp", []);
app.controller ("notectrl",function ($scope)
{
//Basic variables declaration
$scope.Text ="";
$scope.limit = 10;
//Function 1
$scope.charactersLeft = function (){
////Testing Char limits in charactersLeft Function 1
if ($scope.Text.length > $scope.limit)
{
window.alert("Warning !")
}
else
if ($scope.Text.length == $scope.limit){
$scope.Notallow = function (){
////Testing with new NotAllow function in elseif in charactersLeft Function 1
window.alert("Your text limit has reached");
}//NotAllow function :end
}
else{
return $scope.limit - $scope.Text.length;
};//Default else :end
};//Function 1 :end
//Function 2
$scope.clearAllbtn = function (){
return $scope.Text ="";
};//Function 2 :end
});
</script>
</head>
<body>
<div ng-controller="notectrl">
<p>
<textarea ng-model="Text" ng-keydown="Notallow()">
</textarea>
<br><br>
<p>Characters remaining:
<span ng-bind="charactersLeft()"></span>
</p>
</p>
<input type="button" ng-click="clearAllbtn()" value="Clear"/>
</div>
</body>
</html>