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

140
Views
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 answers
Answer question

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 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!