📅  最后修改于: 2022-03-11 14:57:31.390000             🧑  作者: Mango
A BehaviorSubject holds one value. When it is subscribed it emits the value immediately.
A Subject doesn't hold a value.
Subject example (with RxJS 5 API):
const subject = new Rx.Subject();
subject.next(1);
subject.subscribe(x => console.log(x));
BehaviorSubject example:
const subject = new Rx.Subject();
subject.next(1);
subject.subscribe(x => console.log(x));