I am used to Angular but I am just starting to use universal (for SEO).
I want to use a map from amcharts 4, I have no problems using without Angular Universal. I know that it is a known issue but I do not understand why in my case the server tries to load the chart and create this error:
ERROR Error: Uncaught (in promise): ReferenceError: addEventListener is not defined
ReferenceError: addEventListener is not defined
...
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);
// ...
}
}