< H2 > ask how to judge how to change the color of the login button after entering content in two input boxes at the same time < / H2 >
< H2 > ask how to judge how to change the color of the login button after entering content in two input boxes at the same time < / H2 >
you can judge by the value of these two input. If both value are not empty, let the disabled attribute of button be false, otherwise true
<input [(ngModel)]="name" (ngModelChange)="onchange()"/>
<input [(ngModel)]="pwd" (ngModelChange)="onchange()"/>
<button [disable]="isDisable" (click)="onLogin()"></button>
isDisable=true;
name='';
pwd='';
onchange(){
if(name.length>0&&pwd.length>0){
this.isDisable=false;
}else{
this.isDisable=true;
}
}
style when writing CSS to control whether Button is available