javascriptangularangular7stl-format

External JS Files Working in Angular 7 But Not in 8


I'm trying to run these viewstl javascript files in an Angular 8 application. I've run it successfully in an Angular 6 and 7 application by doing the following basics:

As I mentioned, it works fine in Angular 6 but when running from Angular 8 I get the error as soon as the javascript is initialized from the component - and I don't understand why.

GET http://localhost:4300/load_stl.min.js 404 (Not Found)

I'm not necessarily sure if the version difference could be the problem


Solution

  • It turns out there is an extra property on the StlViewer class called load_three_files which takes the path to all the javascript files as argument.

    Moving parser.min and load_stl.min to the assets/script folder and adding load_three_files: "assets/scripts/" to StlViewer fixed it.