0

i want to do some worked in angular when page is reloaded and to some worked when page was loaded .

for example i want to add some items in local storage when item was going to refreshpage ( load page ) and remove some items when page complete loading .

in other word i want do some work after and befor refreshing page in angular .

how can i solve this problem ???

kianoush dortaj
  • 411
  • 7
  • 24
  • 1
    Hey! Could you let us know what you have tried so far, and why it didn't work? – Quelklef Aug 23 '20 at 01:06
  • 1
    Duplicate of [this](https://stackoverflow.com/questions/9308336/execute-function-before-refresh) and [this](https://stackoverflow.com/questions/807878/how-to-make-javascript-execute-after-page-load) – Quelklef Aug 23 '20 at 01:07
  • 1
    Does this answer your question? [How to make JavaScript execute after page load?](https://stackoverflow.com/questions/807878/how-to-make-javascript-execute-after-page-load) – Quelklef Aug 23 '20 at 01:07

1 Answers1

1

You can use Angular Life cycle hooks to achieve that..

Check the docs here.

Khumo Mogorosi
  • 301
  • 2
  • 7