I have experience with Angular, but I am now delving into the world of using Universal for SEO purposes.
My goal is to integrate a map from amcharts 4, which works fine without Angular Universal. However, I am facing an issue where the server attempts to load the chart and generates the following error:
ERROR Error: Uncaught (in promise): ReferenceError: addEventListener is not defined
ReferenceError: addEventListener is not defined
...
Here is my code:
constructor(
@Inject(PLATFORM_ID) private platformId: Object
) {
}
ngOnInit(): void {
this.setUpChart();
}
setUpChart() {
if (isPlatformBrowser(PLATFORM_ID)) {
let chart = am4core.create("world-map", am4maps.MapChart);
// ...
}
}