如何查看angular 2应用程序的页面源 [英] How to view the page source for angular 2 app

查看:66
本文介绍了如何查看angular 2应用程序的页面源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,每当我使用浏览器查看页面源来查看页面源时,我只能看到页面源中的index.html内容,因为我可以看到inspect元素中的所有html代码,但是不在页面源中.请问有人如何查看页面源代码吗?

I have web app, whenever i am view the page source using browser view page source i am only able to see the index.html contents in page source where as i am able to see the all the html code in inspect element but not in page source. Does any one how to view the page source ??

下面是server.ts

Below is the server.ts

推荐答案

只有 Angular Universal (服务器端渲染).每个 javascript 文件都在浏览器中呈现,要查看页面源,您必须设置Angular 2才能在服务器端呈现.这对于SEO优化也很有用.

It is only possible with Angular Universal (server side rendering). Every javascript files renders in browser, to see page source you have to setup Angular 2 to render on server side. It's also useful for SEO optimization.

站点上,您已指导如何进行设置.

On this site you have guide how to setup it.

对于Angular 5,您必须访问此页面,以获取更多信息.

For Angular 5 you have to visit this page, for more informations.

例如在NodeJS上工作,请访问此页面

For example working on NodeJS visit this page

这篇关于如何查看angular 2应用程序的页面源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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