我有一个模块,它将外部库与其他逻辑组合在一起,而无需将<script>
标记直接添加到索引中.html:
import 'http://external.com/path/file.js'
//import '../js/file.js'
@Component({
selector: 'my-app',
template: `
<script src="http://iknow.com/this/does/not/work/either/file.js"></script>
<div>Template</div>`
})
export class MyAppComponent {...}
我注意到ES6规范的import
By是静电的,并且在打字脚本转写期间而不是在运行时解析.
是否要使其可配置,以便file.js将从CDN或本地文件夹加载? 如何告诉Angular 2动态加载脚本?