且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除脚本或Div

更新时间:2022-06-26 07:17:33

您仍然可以在Angular中使用jQuery. 只需在index.html(或_Layout.cshtml,如果使用ASP.NET MVC)中的任意位置插入指向jquery.js脚本的脚本标记链接,则可以在关闭

You can still use jQuery in Angular. Just insert script tag links to jquery.js script anywhere in your index.html (or _Layout.cshtml if you used ASP.NET MVC) It's good to put before closing

<script src="./path/to/your/jquery.min.js"></script>

然后您可以在任何组件中使用jQuery,只需在声明@Component之前放置此行即可.

Then you can use jQuery in any component, just put this line before declare @Component.

declare var jQuery: any;

然后您可以通过以下方式将其删除

Then you can remove it by

jQuery('#tempscript').remove();