I first installed cytoscape.js via npm. In the typescript-file (for Angular) I imported it by “import * as Cytoscape from 'cytoscape';”. And finally to use a Cytoscape instance I could store it in a variable by initializing it via “this.cy = Cytoscape({container: document.getElementById('cy'), … });”.
I have been using Angular 2 for a while, and it can get quite confusing.
I strongly recomend using Angular CLI, not only becuase it creates a basic working application (with a properly organized skeleton), but because it helps the administration of libraries (angular internal or external).
In order to install a library, if you're using Angular CLI, your project (in Angular 2) will have a package "angular-cli.json" where under the section "scripts" every installed package (.js) is referenced.
You will only need to launch the command ng serve, and all packages referenced will be installed!!
I have been using Angular 2 for a while, and it can get quite confusing.
I strongly recomend using Angular CLI, not only becuase it creates a basic working application (with a properly organized skeleton), but because it helps the administration of libraries (angular internal or external).
In order to install a library, if you're using Angular CLI, your project (in Angular 2) will have a package "angular-cli.json" where under the section "scripts" every installed package (.js) is referenced.
You will only need to launch the command ng serve, and all packages referenced will be installed!!