1

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;
}

2 Answers2

1

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>
Shahar Shokrani
  • 7,598
  • 9
  • 48
  • 91
0

Do you need that function isValid()? Are you having more logic in there?

Otherwise you can directly bind to providedId:

<button [disabled]="!providedId">
I am a button
</button>

Stackblitz: https://stackblitz.com/edit/angular-ivy-disabled-binding

Manish
  • 6,106
  • 19
  • 64
  • 90