Siva Kumar S
Siva Kumar S

Reputation: 419

How to import a js file and use it in angular library (not in project)

I am developing image zoom in angular4 library,I need to import openseadragon js file to my library.

If it is angular project then simply i can add cdn to index.html, but in library how can i import js file.

I tried with the angular-cli.json file in the below way, but it didn't worked.

"scripts": [
  "../node_modules/openseadragon/build/openseadragon/openseadragon.min.js"
]

Any solutions will be appreciated..

Upvotes: 3

Views: 1351

Answers (1)

Drag13
Drag13

Reputation: 5978

Try to do the following (and skip any step you already did)

1. Add "openseadragon": "2.3.0" to the package.json.
2. Use npm install.
3. Write in your ts file : import * as dragon from 'openseadragon';
4. Profit :)

Upvotes: 4

Related Questions