且构网

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

为什么ngif不从我的代码中删除脚本标签?

更新时间:2023-12-05 18:51:16

是否删除它们并不重要.到有角度的引导程序启动DOM操作时,所有脚本标签都将由浏览器编译.

It wouldn't matter if they were removed or not. By the time angular bootstraps and starts DOM manipulation all script tags will have been compiled by browser.

删除脚本标记不会删除已经编译的代码.

Removing a script tag does not remove the code that has already been compiled.

关于您要完成的工作或脚本的工作没有更多的信息,这是目前可以提供的全部信息.

Without a lot more information on what it is you are trying to accomplish , or what the scripts do, this is about all that can be offered for now.

我建议您阅读有关将html编译为DOM时浏览器如何处理网页的基础知识.它遇到带有 src 的脚本标签的瞬间,便对该文件发出了请求,并且无法拦截该文件.

I would suggest you read up on the basics of how a web page gets processed by the browser as the html gets compiled to the DOM. The instant it encounters a script tag with an src , a request is made for that file and there is no way to intercept it.