I am currently working on a project in Angular 4 and for some reason I keep experiencing random reloads when I am previewing the app on a browser. (I am running in prod mode). Anyone experiencing the same issue? Any solution found? Thanks.
As already explained its a feature provided by your code editor, currently I am using visual studio code and if you read the documentation, it clearly mentions this feature as a live update. Whenever you save your changes, Visual studio triggers an event which compiles your code via the instance of cmd you are sharing data to the port.
Just take some time out reading the documentation for VS code, it has added a bulk of feature especially to support Angular development.
Your page will be refreshed every time, when watching files will be changed and saved. Normally it happens on every regular save (expected behavior), but in most IDEs you can On/Off autosaving, so if it's On, for example WebStorm saves changes on every frame deactivation and page reload occurs. I suggest, that other IDEs have totally the same behavior. Here is info, how to trigger autosave
in WebStorm:
https://www.jetbrains.com/help/webstorm/saving-and-reverting-changes.html#tuning-autosave
in Android Studio:
How to disable Auto Save save in Android Studio
in Sublime Text:
try to run your app with argument --lr=false
,
by default live-reload is true
and and a server working for watch mode reload app depending on its setting.
Watch out for empty anchor tags,
<a href="#" (click)="abc()">Click Here </a>
This can cause a reload if abc function has return type void or you don't do a return false.
© 2022 - 2024 — McMap. All rights reserved.