I've this HTML markup using Bootstrap:
<div class="col-sm-6" ng-app ng-controller="MyController">
<br/><br/>
<div class="input-group">
<input type="text" name="input" class="form-control" ng-model="input" ng-maxlength="18" ng-minlength="18" placeholder="Type input.." aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2" ng-bind="inputMaxLength"></span>
</div>
</div>
and this AngularJS controller:
function MyController($scope) {
$scope.input = "";
$scope.inputMaxLength = 18;
}
What is the recommended solution for implementing the "charaters left" feature in the bootstrap addon? Further, how can I change the input field so that I cannot type in more then 18 charaters?
See this demo example: http://jsfiddle.net/dennismadsen/7ugzn76s/2/
UPDATE 1
I've updated the JSFiddle, based on your answers. But the countdown does not work: http://jsfiddle.net/dennismadsen/7ugzn76s/3/
how can I change the input field so that I cannot type in more then 18 charaters. This is simple:<input maxlength="18">.{{inputMaxLength - input.length}}.