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

357
Views
Angular 12 : c.getComputedStyle is not a function

I'm using the new dom-to-image lib and I'm facing this error when I try to call the toPng method inside of a component.

import domtoimage from 'dom-to-image-more';
export class MyComponent {
    @ViewChild('leafletMap') leafletMap: ElementRef;
    
    downloadMap = (): void => {
        //error happens here
        domtoimage.toPng(this.leafletMap.nativeElement).then((img: any) => {
            console.log(img);
        });
    };
}
/* of course this is simplified */

The leafletMap exists in my components HTML and when I log it, it contains a HtmlNativeElement

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Seems there is an issue with the latest version of the lib. Try using this version:

"dom-to-image-more": "2.8.0"

I have created a working StackBlitz, click on download button and see the result.

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!