Ad

How To View The Page Source For Angular 2 App

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 ??

Below is the server.ts

enter image description here

Ad

Answer

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.

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

For example working on NodeJS visit this this site you have guide how to setup it.

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

For example working on NodeJS visit this page

Ad
source: stackoverflow.com
Ad