I want to show the name of the row in the header which I am going to edit in my edit page of each row.

I tried using localStorage set the key and get on the edit page using.

Listview.ts file .passing row name to edit

 if (element.name) {
      this.dataService.pageName = element.name;
      this.dataService.setLocalStorage(environment.localStorageKeys.PAGENAME, element.name);

commmon data service file

pageName = this.getLocalStorage(environment.localStorageKeys.PAGENAME)
    ? this.getLocalStorage(environment.localStorageKeys.PAGENAME)
    : '';

fetching data on edit page

this.inviteCodeCrud[ 'page' ][ 'label' ]= 
 'edit' + ' for ' + this.dataService.pageName 

on the edit page, it must show like "Edit for ram", works ok when I come for the first time in a module on the list of the row but when I come back to list and again go back to another row edit it keeps on adding, like "Edit for ram for Shyam" and adding continuously, once I reload the page it works fine but not happening in angular routing

0 Answers