It's hard for me to grasp to the point I need comments to make it easier. Subjects are observables themselves but what sets them apart is that they are also observers. rev 2021.1.18.38333, The best answers are voted up and rise to the top, Code Review Stack Exchange works best with JavaScript enabled, Start here for a quick overview of the site, Detailed answers to any questions you might have, Discuss the workings and policies of this site, Learn more about Stack Overflow the company, Learn more about hiring developers or posting ads with us. See here for integration. I love typed variables, therefore, I would take the extra step to create custom types if none are provided. So, we have two components, the navigation component with the menu, and the view-task component with a form. Previously (because it wasn't.         {{task.title}} But i would assume its much more complicated. Where we have to type following CLI command to create new Angular 5 project. Watch later. And this is the getTask() function from the menu: ngOnInit() { And magically it shows in our menu component. Thank you very much! And all are kind of valid :-) If you want to return an Observable, you cannot subscribe to it. I haven't yet coded in the scenario on what to do if the Refresh Token expires/is close to expiring but I'm doing this step by step and that's next on the list. Both of them, are connected to the task.service.ts, which will call the HTTP request. What language(s) implements function return value by assigning to the function name. // But you can get an equivalent code with BehaviorSubject by // coding like this: // private _coachProfile$: BehaviorSubject = // new BehaviorSubject(null); private _coachProfile$: ReplaySubject = new ReplaySubject(1); coachProfile(token :string) { …         tap(tasks => this.log(`fetched tasks`)),     What does that mean? Other versions available: Angular: Angular 10; In this post we'll go through an example of how to implement JWT authentication with refresh tokens in Angular 9. const subject = new BehaviorSubject(0); //0 is the initial value. It means that a subject can emit data, on top of having the capability to be subscribed to. My application is a board game. I'm sure that there are a better approach to the same solution, but for practical purpose the app is doing what it have to do . I would move each exported element into its own file, to separate them more clearly, At least that would be my approach. So, this is not connected with the updateTask() function from the view-task component. Reactive Angular with RXJS - Auto Refresh via Subject. For this demo, I have used Angular version 9. This might be from a local JSON file, local storage, a remote database, or some other kind of data store. Because the only way to update the menu task list is calling the getTask() function.       const url = `${this.mainUrl}/node/${id}`;         Angular 4/5 , using service and reactive extension (rxjs) share/sync data across components. A slim Observable is used in Angular … Stores are otherwise just good ol’ Angular service classes. An even bigger problem is that I don't fully understand the code and thus am struggling to split the intercept function into smaller chunks to move into their own functions. Natürlich würde ich den Aufruf in eine refresh -Methode einschließen und ihn von der Datenquelleninstanz mit der Komponente und anderen geeigneten Techniken abrufen.