Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从angular component调用Web包代码(bundle.js)中的函数?_Angular_Webpack - Fatal编程技术网

如何从angular component调用Web包代码(bundle.js)中的函数?

如何从angular component调用Web包代码(bundle.js)中的函数?,angular,webpack,Angular,Webpack,我试图从一个角度组件调用webpacked库(bundle.js)中的函数。我使用它绑定了我的库,并且能够使用答案中的代码从index.html文件调用该函数。我还在angular项目中包含了捆绑的js库,现在我想从angular中的某个地方调用它,比如从组件调用它 到目前为止,我试图用这样的角度组件声明我的库 declare const the_library: any; the_library.method1(); 然后从组件中的某个地方使用它,就像这样 declare const t

我试图从一个角度组件调用webpacked库(bundle.js)中的函数。我使用它绑定了我的库,并且能够使用答案中的代码从index.html文件调用该函数。我还在angular项目中包含了捆绑的js库,现在我想从angular中的某个地方调用它,比如从组件调用它

到目前为止,我试图用这样的角度组件声明我的库

declare const the_library: any; 
the_library.method1();
然后从组件中的某个地方使用它,就像这样

declare const the_library: any; 
the_library.method1();

但是我得到了一个错误:错误引用错误在配置中没有定义\u库,您是否有
库:“theu库”
?如果打开开发人员工具并在控制台中键入_library.method1(),它会运行所需的函数吗?thanx,解决方案。。。。。。我将bundle.js包含在angular.clis样式数组中,而不是脚本数组facepam中。多好的解决方案啊。英雄联盟