Search code examples
angularjsrootscope

Lifetime of values stored in $rootScope


I wanted to know what is the lifetime of the values stored in $rootScope especially in cases when the page is opened in a different tab.Whether the value gets lost or will it be retained in the newly opened tab?


Solution

  • If you mean a different tab in your browser, no variable is shared at all, unless you use localStorage (which is not something related to Angularjs).

    If you are using tabs designed in some application of yours, they should share $rootScope and all of its variables.