Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
Angular click event doesn't work in <object> element

I'm working on an Interactive map using an SVG map divided in multiple regions, What I'm trying is to catch the clicked element (path element that represents the region) to apply some styling with it.

My angular component has the following template :

<object type="image/svg+xml" data="/assets/img/regions_map.svg" (click)="handleRegionClick($event)"></object>

for the Ts file :

export class RegionsMapComponent implements OnInit {

  constructor() { }
  ngOnInit() {
  }

  /** handle the click on the map*/
  handleRegionCLick($event: MouseEvent) {
    console.log('hello');
  }

}

But here clicking on the map SVG doesn't call my function, so i cannot catch the Id of the clicked region to highlight.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The <object> tag was originally designed to embed browser Plug-ins. More in general, it is better to embed a picture with the <img> tag (which is working well with the click event):

<img src="/assets/img/regions_map.svg" (click)="handleRegionClick($event)" />
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda