在Angular4服务中使用commonjs模块?

时间:2017-05-11 22:11:13

标签: javascript angular typescript typescript2.2

我首先使用我安装的commonjs模块进行测试:

runOnUiThread(()->{webView2.loadUrl("javascript:f()");});

然后我创建了npm install the-module; ,看起来像这样:

main.js

然后使用webpack将var module = require('the-module'); module.doStuff(); 编译成main.js,将其加载到浏览器中,然后就可以了。

现在我想在角度4服务中使用bundle.js。我应该如何导入它?

我还发现了this article如何创建角度2组件库。很想知道Angular将导入的所有commonjs模块是否需要这组步骤,或者是否有更直接的方法?

0 个答案:

没有答案
相关问题