Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
Angular 4: el nuevo MouseEvent provoca un error de IE11

Tengo un problema con mouseEvent en angular 4 en IE11. Estoy usando angular 4, angular-cli.

Cuando activo esta línea de código:

 let newEvent = new MouseEvent('mouseleave', {bubbles: true});

IE está lanzando tal excepción en la consola:

 TypeError: Object does not support this operation. at MenuItemComponent.prototype.onClick (./main.bundle.js:821:13) at Anonymous function (Function code:37:9) at handleEvent (./vendor.bundle.js:12039:87) at callWithDebugContext (./vendor.bundle.js:13247:9) at debugHandleEvent (./vendor.bundle.js:12835:5) at dispatchEvent (./vendor.bundle.js:9014:5) at Anonymous function (./vendor.bundle.js:9604:31) at Anonymous function (./vendor.bundle.js:19253:9) at ZoneDelegate.prototype.invokeTask (./polyfills.bundle.js:10732:13) at onInvokeTask (./vendor.bundle.js:4357:21) at ZoneDelegate.prototype.invokeTask (./polyfills.bundle.js:10732:13) at Zone.prototype.runTask (./polyfills.bundle.js:10501:21) at invoke (./polyfills.bundle.js:10796:21)

Descomenté todo en mi polyfils.ts y reconstruí el proyecto, probé IE y ES6 shims...

No puedo encontrar nada similar en Google, y creo que este es un problema tonto: ¿alguien de la nube me indica la solución?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Puedes hacer trucos para IE:

importar { Componente, OnInit, ElementRef, ViewChild } desde '@angular/core';

...

@ViewChild('fileInput') public fileInput: RefElemento;

...

 // Trigger button click event let event; if (document.createEvent){ // Only for IE and Firefox event = document.createEvent('MouseEvent'); event.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); } else { // For Chrome event = new MouseEvent('click', {bubbles: false}); } this.button.nativeElement.dispatchEvent(event);
over 4 years ago · Santiago Trujillo Report

0

Prueba en el archivo html :

 <div #sample>You need to click me</div>

en el archivo componente.js:

 @ViewChild('sample') sampleEle: ElementRef;

y el uso del evento de clic como en el js como:

 this.sampleEle.nativeElement.click();
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!