-1

Is there a way in Angular to clear All Local Storage or at least ones particular to the application through maybe ng build, or Angular deployment, or through Angular code itself? This inthrough in Chrome F12 Local Storage.

This is the code base, https://stackoverflow.com/a/43637348/14432516

localStorage.removeItem('currentProduct');
localstorage.clear();

However, I need to to Detect First Deployment in Angular. How can this be done?

enter image description here

1 Answers1

2

You could add your app version at your environment.appVersion on app load store that value to your local localStorage and on your app load get version from local storage if that version exist check if that version is the same as version in environment.appVersion. When they are different clear localStorage. on every deploy update your environment.appVersion.

Filip
  • 143
  • 1
  • 8