Add elements to rxjs BehaviorSubject or Subject of an array in Angular2+
问题 I was reading up on how to share data between unrelated components in Angular from the "Unrelated Components: Sharing Data with a Service" section of the tutorial here. I see how this example works for the string they are trying to share across their components, but my data type is a little more complex: Namely, I think my BehaviorSubject should look like this: private currentPopulationSource: BehaviorSubject<Population> = new BehaviorSubject<Population>(new Population(new Array<Organism>()))