Closed richarddavenport closed 7 years ago
I have the same question. It looks like it just recompiles the root component... but I, too, was hoping for saving state. One of the best benefits of hmr
is you can style a modal or something and see the changes without having to re-open the modal.
I actually figured this out. With HMR it only knows about state that is stored in a service/component/module, not just anything in the DOM. So, in my example, if the input in the template was using ngModel, then it would keep that state. HMR, from my limited experience, is not able to just grab whatever was in the DOM. That's not how it works. Hope this helps! I think we can close this now.
This appeared to be promising, but after trying a simple test, this isn't actually doing true hot module reloading. What I mean is the dom state is gone after the modules are reloaded. I added an input to the app.component.html:
Here's a screencast:
Is this the expected behavior?