Hi All,


Please help me in this.

Below is the my login template code.

<form #loginForm="ngForm" (ngSubmit)="login()">
                                                <div class="form-group">
                                                        <label 
for="username">Username</label>
                                                        <input type="text" 
name="userName" required [(ngModel)]="loginDetails.userName" 
#userName="ngModel" class="form-control underline">
                                                        <div 
[hidden]="userName.valid || userName.pristine" class="error">
                                                                User Name Is 
required!
                                                        </div>
                                                </div>
                                                <div class="form-group">
                                                        <label 
for="password">Password</label>
                                                        <input type="password" 
name="password" required [(ngModel)]="loginDetails.password" 
#password="ngModel" class="form-control underline">
                                                        <div 
[hidden]="password.valid || password.pristine" class="error">
                                                                Password is 
required!
                                                        </div>
                                                </div>
                                                <div class="text-right">
                                                        <button class="btn 
btn-primary" type="submit" [disabled]="!loginForm.form.valid">Login</button>
                                                </div>
                                                <div class="clearfix m-t-1">
                                                        <span class="checkbox 
pull-left login-text">
                                                <label>
                                                        <input type="checkbox" 
class="valign-2"> Remember me
                                                </label>
                                        </span>
                                                        <a class="pull-right 
login-text" href="#" [routerLink]="['/forgotPassword']">Trouble with 
account?</a>
                                                </div>
                                        </form>

At root form tag i have added local variable with ngForm and in input 
element I have included the required attribute and on the submit button 
 [disabled]=!loginForm.form.valid  the form is always flagged as valid even 
when the required input is empty. What am I missing here?

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to