If you want to notify other components of changes to data you can use a event model. Basically you create a singleton service that is injected into your components. This service has a Subject field which can be used to broadcast changes as well as subscribe to that broadcast.
userMenu.component.ts
import { Component, OnInit } from '@angular/core'; import { UserStateService } from './userState.service'; export class UserMenuComponent implements OnInit { constructor(private readonly userStateService: UserStateService) { } ngOnInit() { this.userStateService.userChanged .asObservable() .subcribe(userInfo => {/* do something */}); } }
userInput.component.ts
import { Component, OnInit } from '@angular/core'; import { UserStateService } from './userState.service'; export class UserInputComponent { userData: any; constructor(private readonly userStateService: UserStateService) { } onSave() { this.userStateService.userChanged.next(this.userData); } }
userState.service.ts
import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class UserStateService { userChanged = new Subject(); }