如何解决如何将 Javascript 文件导入 angular 的 shadow dom
我有一个 Angular Web 组件(angular-elements),我正在尝试将 bootstrap.js 和 jquery 包含到我的组件中
@Component({
selector: 'catalago-component',templateUrl: './list.component.html',styleUrls: ['./list.component.scss'],encapsulation: ViewEncapsulation.ShadowDom
})
我尝试了以下方法:
angular.json
"scripts": [
"./node_modules/jquery/dist/jquery.js","./node_modules/bootstrap/dist/js/bootstrap.js"
]
list.component.html
<script src="node_modules/bootstrap/dist/js/bootstrap.js"></script>
<script src="node_modules/jquery/dist/jquery.js"></script>
list.component.ts
import 'node_modules/jquery/dist/jquery.js';
import 'node_modules/bootstrap/dist/js/bootstrap.js';
他们都没有工作,但如果删除 encapsulation: ViewEncapsulation.ShadowDom
那么它工作正常。那么如何在不删除 ViewEncapsulation.ShadowDom
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。