如何检查或证明angular2中的模块是延迟加载的? [英] How can I check or prove that a module in angular2 is lazy loaded?

查看:56
本文介绍了如何检查或证明angular2中的模块是延迟加载的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我可以访问angular2应用程序的代码,并且有一个模块据说是延迟加载的,那么有没有一种方法可以独立于检查代码,我可以测试该模块以查看它是否是延迟加载的.如有必要,没有其他方法,可以将代码添加到有问题的模块中进行测试.但是我要添加什么代码?

If I have access to an angular2 application's code and there is a module that is supposedly lazy loaded, is there a way, independent of examining the code, that I can test that module to see if it is lazy loaded. If necessary and there is no other way, I could add code into the module in question to test, if that is a possibility. But what code would I add?

推荐答案

在Google Chrome浏览器中检查Chrome开发者工具(ctrl + shift + i)的 网络 标签浏览器.

Check the Network tab of chrome dev tools (ctrl + shift + i) in the Google Chrome browser.

如果您的模块不是延迟加载的,则在站点首次加载时,您会在网络标签中看到该模块的行.

If your module is not being lazy loaded you will see a row for the module in the network tab when the site first loads up.

如果延迟加载得当,那么只有在导航到相应的路线时,才会看到模块的行.

If it is being lazily loaded properly then you will see the row for the module only when you navigate to the corresponding route.

希望这会有所帮助.

这篇关于如何检查或证明angular2中的模块是延迟加载的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆