Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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..

like image 779
Siva Kumar S Avatar asked Jan 27 '26 02:01

Siva Kumar S


1 Answers

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 :)
like image 164
Drag13 Avatar answered Jan 29 '26 15:01

Drag13



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!