I have a simple form on my web app asking for username and password. I have used the standard angularjs validation.
But when i load the page the validation messages appear straight away. Not sure why this is. I have my final form markup below
<div ng-controller="LoginCtrl">
<form name ="loginForm" novalidate>
<div class="input-group" style="margin-left:100px;">
<input id="username" type="text" name="username" ng-model="user.name" class="form-control" placeholder="Username" required>
<span class="alert-danger" ng-show="loginForm.username.$error.required">Username is required.</span>
<input id="password "type="password" name="password" ng-model="user.password" class="form-control" placeholder="Password" required>
<span class="alert-danger" ng-show="loginForm.password.$error.required">Password is required.</span>
</div>
<input class="btn btn-lg btn-success" type="submit" id="submit" value="Login" ng-click="loginUser()" />
<pre>Username={{list}}</pre>
</form>
</div>
Any ideas?