I have input
that I want to validate via AngularJS. But this input is not inside a form. So when trying to access the form's validation information, I was not successful:
<div class="form-group">
<input name="nick" type="text" class="form-control" ng-model="username.nick" ng-maxlength="10">
<span class="help-block" ng-show="nick.$error.maxlength">Máximo permitido é 10</span>
</div>
But if I do it that way, it works:
<form name="formUser">
<div class="form-group">
<input name="nick" type="text" class="form-control" ng-model="username.nick" ng-maxlength="10">
<span class="help-block" ng-show="formUser.nick.$error.maxlength">Máximo permitido é 10</span>
</div>
</form>
In this specific case, I would like to use validation similar to the second example, but without a form.
Is there any way to validate angularity without using the form?