Passing data back from nav.pop()

Hi, Below example might help you.
Create a service named sharedVariable.ts

import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root',
})
export class sharedVariableService {
  sharedUserName: String = "" //set default value here.
  constructor() { }
  
  getSharedUserName(){
  return sharedUserName;
  }
  setSharedUserName(string name){
    sharedUserName  = name;
  }
}

Now in you component from where your popping the navigation. Import sharedVariableService in constructor.

constructor(sharedVariable : sharedVariableService ) { }

Before you create pop from navigation stack, just call the method setSharedUserName and pass value of your choice. And use the updated value from getSharedUserName function in the component of your choice.

Revert if you still have further doubts.

The problem with that approach is “how do I communicate that sharedUserName changed to a consumer that has cached a stale value?”, which leads to all sorts of lifecycle event abuse. Addressed in more detail here.

How are you passing data on your end?

using services concept , which fast and easy to maintain