Sumei Su
Sumei Su

Reputation: 61

Angular2 button not disabled when the form is initialized on IE11

I am using Angular2 and PrimeNg to create a form.. There is a button that needs to be disabled when the form is not dirty or when it is invalid. All the things work well on Chrome but not on IE11. Here is the code ... the Modify button is not disabled as expected.

<button pButton type="submit" icon="fa-pencil" (click)="modify()"
[disabled]="!form.dirty || form.invalid || 
disableModifyButton" disabled="true" label="Modify"></button>

Any ideas on how to solve this?

Upvotes: 1

Views: 993

Answers (1)

Lon Yang
Lon Yang

Reputation: 696

disabled only have one attribute value is disabled, so try this

[disabled]="(!form.dirty || form.invalid || disableModifyButton) ? 'disabled' : null"

Upvotes: 1

Related Questions