Search code examples
angularvalidationangular8disabled-control

[disabled]="!isValid()" is not working in IE11 for Angular 8


disabled attribute with function is not working in IE11. It remains disable all the time. Please refer below code:

HTML:

 <button type="submit" (click)="onSubmit()" [disabled]="!isValid()">SAVE</button>

Component (.ts)

isValid(){
    return this.providedId != null;
}

Solution

  • Try working with a getter, so you won't need the parentheses inside the template:

    get isValid(){
        return this.providedId != null;  
        // Or any other complicated logic...
    }
    

    And the template without the parentheses:

    <button [disabled]="!isValid">SAVE</button>