You can use an @Service with a BehaviorSubject. The BehaviorSubject contains the value that needs to be shared with other components, it at least time is Observer and Observable it can receive and issue the current values.
You will need a Service with an attribute of type BehaviorSubject, in my example I created the same with type number and a default value of 0, as below:
@Injectable()
export class QuoteService {
public openQuotes = new BehaviorSubject<number>(0);
setOpenQuote(quotes : number){
this.openQuotes.next(quotes);
}
}
In the Table component is where you will get the data, and send it to the BehaviorSubject, then you need to inject the Service into the Table component, and in the method called by the green button, you will send the data: / p>
construtor(
quoteService : QuoteService
){}
acaoBotaoVerde(){
this.quoteService.setOpenQuote(quotesOpened);
}
And in the navigation component you will simply make a subscribe to be monitored if the information changes:
construtor(
quoteService : QuoteService
){}
this.quotesOpen = this.quoteService.openQuotes.subscribe(
(quotes) => {
return quotes;
}
);
Of course, this code can be optimized, but it helps you get an idea of what to use.