angular - Angular2 RC - troubleshot disabled button -


these first question here, please tell me if i've done wrong fix :)

i've got problem make [diabled] tag work correctly on button in form.

here template :

<form #loginform="ngform">       <label class="omwave">identifiant</label>       <input type="text" class="omwave" [(ngmodel)]="login" placeholder="identifiant" name="login" required>       <label class="omwave">mot de passe</label>       <div class="input-group omwave">         <input type="password" class="input-group-field omwave" [(ngmodel)]="password" placeholder="mot de passe" name="password" required>         <div class="input-group-button">           <button type="submit" (click)="gologin()" value="submit" class="" [disabled]="!isvalid"><img width="25px" src="imgs/start_service.png" alt="login_button"></button>         </div>       </div>     </form> 

and here component :

import {component} '@angular/core'; import {form_directives, ng_validators, validators, control} "@angular/common";  @component({   selector: 'login',   templateurl: 'app/core/templates/login.html',   directives: [form_directives] })  export class logincomponent {   protected login: string;   protected password: string;    constructor() {    } } 

when 2 input login , password empty, got ng-invalid property on , button disable. if fill inputs, got ng-valid property button still reamin disabled, , d'ont know why because form valid when inputs filled. if has idea please :) if need other informations, i'll try answer it.

thanks reading.

regards,

i use following based on inline form support of angular2:

<form #loginform="ngform">   <label class="omwave">identifiant</label>   <input type="text" class="omwave" [(ngmodel)]="login"           placeholder="identifiant" name="login"          ngcontrol="name" required> <--------   <label class="omwave">mot de passe</label>   <div class="input-group omwave">     <input type="password" class="input-group-field omwave"           [(ngmodel)]="password" placeholder="mot de passe"          ngcontrol="password" name="password" required> <-------     <div class="input-group-button">       <button type="submit" (click)="gologin()" value="submit"            class="" [disabled]="!loginform.valid"> <------         <img width="25px" src="imgs/start_service.png" alt="login_button">       </button>     </div>   </div> </form> 

in case, don't know how isvalid property handled , corresponds. can directly rely on form state (loginform) , valid property.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -