0

I am getting the weird issue in Angular2 project.

Whenever I do ng build from command prompt, I am able to view HTML in view source but If I run on my Apache server after building a project (From dist directory), I can only view part of it.

ng build -prod --build-optimizer --app 0
ng build --aot --app 1
webpack -p

When I build project from command prompt and it serve it from ng

After I run from Apache server (XAMPP on Windows 10)

enter image description here

Please help me regard this, It is critical for SEO.

  • It is the expected behaviour. View source only shows you the content of the page after the initial load, it doesn't show dynamic DOM elements added by scripts. To see the rendered HTML, you need to use the DOM inspector (in Chrome, right-click on an element on the page and select `Inspect`). Also note that not all search engines can parse dynamic websites. – DarthJDG Dec 13 '17 at 12:37
  • I got a solution for this. I build and serve using ng on port 4200 and then used pm2 to run server continuously as a daemon and then serving the same server using reverse proxy on Apache. – Ganesh Sawant Dec 16 '17 at 07:22

0 Answers0