0

In my application i'm using the angular (click)-Event on an option-tag. The event is fired correctly in Chrome and Firefox. Sadly it isn't fired in IE11.

My code looks like this:

<select ...>
    <ng-template ngFor ...>
        <optgroup ...>
            <option ... (click)="fireEvent()">...</option>
        </optgroup>
    </ng-template>
</select>

(The "..." are just abbreviations for some attributes that doesn't have any influence here.)

According to some other internet sources, my problem with the IE11 and the click Event in angular seems to be a known issue since....let's just say since a long time :D

There are some solutions for other HTML-Structures which doesn't work in this case.

Does anyone know some workaround for the IE11 ?

  • [Reference](https://stackoverflow.com/questions/45264292/click-only-working-in-chrome-not-working-in-others?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) instead of option click you should try someother way. – Manikandan Apr 17 '18 at 14:05

1 Answers1

1

I found a solution for this issue on my own. I didn't manage to get the click event running, so i tried to implement a workaround. My workaround is using the (change) event on the Tag. Everytime i click on another option the (change) event is emitted. The model for the currently selected Item is still updated in my angular component, so everything seems fine.

<select ... (change)="fireEvent()">
<ng-template ngFor ...>
    <optgroup ...>
        <option ... >...</option>
    </optgroup>
</ng-template>