Angular 8 Shapediver integration error

Hi Guys,

My developer is experiencing this error when running Shapediver on Angular 8:

Here is the code that we are running:

import { Component, ViewChild, AfterViewInit, ElementRef } from ‘@angular/core’;

@Component({
selector: ‘app-shapediver’,
templateUrl: ‘./shapediver.component.html’,
styleUrls: [’./shapediver.component.scss’]
})
export class ShapeDiverComponent implements AfterViewInit {
window: any;
@ViewChild(‘sdv’) sdv: ElementRef;

ngAfterViewInit() {
this.window = window;
// let _container = document.querySelector(’.approach__shapediver’);
let settings = {
container: this.sdv.nativeElement,
ticket:
‘aa45cceb37f09aa9d0105cbaa5d8960c2cfd7f9ea1db5d94147af7de5a80905b1870800103189262fc4eb52ceacac640158ff1dda9b023bf6db6b2cada72ac09071f564bd1616038ae319018447a098f45672ec3f29f6de215a75a22d870cdeda1f24d18d4b89578a43c50acd3b63ebdb6db16db8df7-bd598b3e0aa916828bc38717d5f4fbbf’,
modelViewUrl: ‘eu-central-1’
};
// See https://viewer.shapediver.com/v2/2.14.0/doc/SDVApp.ParametricViewer.html for all settings available via the constructor.
this.window.api = new this.window.SDVApp.ParametricViewer(settings);
}
}

What are we doing wrong?

Thank you for your help in advance!

Regards,

Jonas Blazinskas

Some of our users had a similar issue when trying to integrate the viewer in React. You could have a look at the React example we built, as well as the associated forum topic.

Hopefully that points you towards a solution. If you end up with a minimal working Angular example, that would be really useful! In that case, you could share your findings here and I’ll add it to the documentation.

Hi Mathieu,

I’ve forwarded the message to the developer, we have a working version done with react but it does not seem to work with Angular 8. Maybe Alexander could give a simple example of implementation in Angular 8, because we suspect something might not working as intended? Thank you for your help in advance!

Regards,

Jonas Blazinskas

Hi @Jonas-Blazinskas, I just realized that you are probably using an old version of our viewer (2.14.0). Support for React was introduced in 2.16.0. Please try using the latest version which is 2.19.3 as of today. You can find the latest version by following this link: https://app.shapediver.com/api