Open niklas-dahl opened 7 years ago
I found https://github.com/beeman/tutorial-angular-cli-hmr/issues/2, but I'am using ngModel and still my state is not preseved.
Not working for me either - anyone know if this can work? I attached a screenshot of a simple example of counter - when app.component.ts
is changed, doesn't preserve state of counter.
Thanks for any help 👍
In the terminal it says the following:
Hot Module Replacement (HMR) is enabled for the dev server.
The project will still live reload when HMR is enabled,
but to take advantage of HMR additional application code is required
(not included in an Angular CLI project by default).
See https://webpack.github.io/docs/hot-module-replacement.html
for information on working with HMR for Webpack.
EDIT
Run ng eject
to edit the webpack config. It's a long file.
@PascalAOMS What do you mean? What exactly should I do in order to preserve state?
Please add your response at https://stackoverflow.com/questions/49595833/how-to-preserve-state-during-hmr-using-angular.
this is great, but I thought hmr meant that the state of the application is preserved during the reload, is that possible?
I'am thinking that it could be possible to just re-initialize the component that changed and all its child components, but preserve state in the rest of the component tree.