0

I m trying to call a function in webpacked library (bundle.js) from an angular component. I used this anwer to bundle my library and was able to call the function from an index.html file using the code from the answer. I also included the bundled js library in my angular project and now i would like to call it from somewhere in angular, like from a component.

So far i tried to declare my library in an angular component like this

declare const the_library: any; 

then use it from somewhere in component like this

the_library.method1();

but i m getting error : ERROR ReferenceErro the_library is not defined

  • In config, do you have `library: 'the_library'`? If you opened the developer tools and typed in the console `the_library.method1()`, will it run the desired function? – yazantahhan Sep 28 '19 at 14:19
  • thanx, the solution...... i included my bundle.js in angular.clis styles array instead of scripts array *facepam*. What a solution. lol. – Ivano Gany Sep 28 '19 at 14:41

0 Answers0