Well, for starters, this isn't a form. If you want to keep this structure, you can simple apply a model on the checkbox, and place an "invalid" property conditionally depending on the value of $scope.checked
, like so:
<ul>
<li class="terms_checkbox">
<input ng-model="checked" type="checkbox" id="checkbox_terms" name="terms" />
<label for="checkbox_terms"></label>
</li>
<li class="accept">I have read and accept the terms and conditions</li>
</ul>
However, I would recommend surrounding it inside an actual form, and placing the required
attribute on the checkbox. This :
<form name="myForm">
<ul>
<li class="terms_checkbox">
<input type="checkbox" id="checkbox_terms" name="terms" required />
<label for="checkbox_terms"></label>
</li>
<li class="accept">I have read and accept the terms and conditions</li>
</ul>
</form>
Now, If you check the $scope.myForm.$invalid
property, it will let you know whether the form has been validated.