What is the purpose of this angular code? (related to obtaining and modifying data)

doing a fetch data file and be able to edit modified exercises

use the following code to implement these code, but I can"t understand them.

can someone explain to me roughly what the following code is doing

service:

import { test} from "./dataT";

import { BehaviorSubject } from "rxjs/BehaviorSubject";
import "rxjs/add/operator/map";
import "rxjs/add/operator/catch";
import { Observable } from "rxjs/Rx"

private sessionStatus = new BehaviorSubject<any>([]);
currentSession = this.sessionStatus.asObservable();

  changeSession(obj) {
    this.sessionStatus.next(obj);
  }

component:

onlineStatus
this.tableDataService.currentSession.subscribe(session => this.onlineStatus = session);

dataT:

export let test=  [
  {
    "abc1": "a",
    "abc2": "b",
    "abc3": "c"
},
{
    "abc1": "",
    "abc2": "",
    "abc3": "PT"
}

]

Nov.19,2021

The difficulty of

this code is to understand the BehaviorSubject of rxjs

here are two articles to refer to
https://www.learnrxjs.io/subj.
https://www.jianshu.com/p/982.

.
Menu