我试图在我的 ngclass 中添加 2 个条件,但它不起作用。
<input type="password" [ngClass]="{active: submitted && !form.controls['password']}" [formControl]="form.controls['password']" required>
this.submitted = false;
onSubmit(form: any) {
this.submitted = true;
}
我的事件是一个带有边框错误的类,我试图在点击时显示错误。
最佳答案
嗨,你可以试试这个!
对我来说工作很好!
ng-class=" {'active' : your condition, 'disabled' : your condition } "
关于angular - 如何将 2 个条件放入 AngClass 中 Angular 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42415943/