I have an angular form. I am trying to implement some validation on required fields, like in this nice tutorial, which says that angular has this functionality "built in". However- it isn't working for me. When I submit the form without having filled out the fields, nothing happens. Can anyone see why?
<form id = "myForm" name="myForm" novalidate>
<div class="form-group" ng-class="{ 'has-error' : myForm.name.$invalid && !myForm.name.$pristine && submitted }">
<input type="text" name="name" class="form-control" ng-model="company.name" required>
<p ng-show="myForm.name.$invalid && !myForm.name.$pristine" >Your firm's name is required.</p>
</div>
<br />
<br />
<div class="form-group" ng-class="{ 'has-error' : myForm.address.$invalid && !myForm.address.$pristine && submitted }">
<input type="text" class="form-control" id = "address" name="address" ng-model="company.address" required>
<p ng-show="myForm.address.$invalid && !myForm.address.$pristine" class="help-block">Your address is required.</p>
</div>
<button type="submit" ng-click= "createAccount()" class="btn btn-small btn-primary">GO
</button>
</form>
I have also included $scope.submitted = true;
in my createAccount() function.