Search code examples
angularangular12

how save the state of a page between navigation


I would save the position between navigation from a page to another, for example when i click in a link and return from the left arrow of the browser i would that it return in the position of the link i clicked into the view . How can I do it in Angular ? Thank you

 <a [routerLink]="['/productfood']" [queryParams]="{idt: 1,idc:0,ids:0}" >
       <img src="assets/img/food.jpg" style="width:180px;height:100px;" StyleClass="img-category"/>
       <br/> Food
       </a>

Solution

  • I think you can use the local storage or store the session, refer to MDN docs for the session storage: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/sessions/restore enter image description here