I am working on Angular 4 application. I have implemented the routes also. While navigating from menus it is working fine also when we tried navigation by directly entering url in browser address bar and hit enter butten, the application successfully navigated to that page, but i seen the entire application reloaded. Browser console window cleaned/refreshed Is it expected behavior or something i am missing. How to avoid this ?
When you are navigating using routerLink, the Javascript changes the URL , i.e, it is not regarded as reload of the web page.
However, when you hit enter in the address bar, the page is reloaded, .i.e, the content is again served from the server which serves the index.html (if you do not have any other HTML defined to be served in place of index) and hence the application reinitializes.
That is why all the components get reloaded.
You can refer to the angular docs for more information