Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda