title: Angular BehaviorSubject Unexpected Behavior: Changing without Next()
body: <p>I am having some unexpected "behavior" for my BehaviorSubject in Angular. When my app loads, I get a bunch of objects (statuses) and set them to an observable:</p>
  
  <pre><code>public statuses$ = new BehaviorSubject&lt;any&gt;(null)
  
  public getStatuses(): Promise&lt;any&gt; {
      return this.http.get&lt;any&gt;(this.url, { headers: this.headers })
          .toPromise()
          .then(res =&gt; {
              this.statuses$.next(res);
              return res;
          });
  }
  </code></pre>
  
  <p>In my component, I subscribe during ngOnInit and assign it to a variable so I can use it in my template:</p>
  
  <pre><code>ngOnInit() {
      this.appointmentStatusesService.statuses$.subscribe(statuses =&gt; {
          this.statuses = statuses; 
      });        
  }
  </code></pre>
  
  <p>Simple enough. Short version of what I am doing: I loop through those statuses in my HTML Template w/ngFor. The user clicks on the status, and it displays the status via a form. (this is the function that is used when a user clicks on a status):</p>
  
  <pre><code>public viewStatus(seqNo: number) {
      const statuses = this.appointmentStatusesService.statuses$.getValue();
      for (let x = 0; x &lt; statuses.length; x++) {
          if (statuses[x].seqno === seqNo) {
              this.currentStatus = statuses[x];
              break;
          }
      }
  }
  </code></pre>
  
  <p>Now, the issue I am running into is that any changes that are made to the form, also change the statuses$ observable, even though I am not calling .next(). This is what my form looks like:</p>
  
  <pre><code>&lt;input type="text" class="form-control" [(ngModel)]="currentStatus.name"&gt;
  </code></pre>
  
  <p>Somehow, when the name of currentStatus is changed (which was assigned when the user clicked "VIEW STATUS", it ALSO changes the statuses$ observable. In other words, whatever changes are made to currentStatus object are also done on to statuses$ observable. It's as if there is a two way binding of some sort. I was under the impression that, in order to push changes to an BehaviorSubject, you had to call .next() method. I perhaps am misunderstanding how BehaviorSubject works but I would really appreciate it if someone were able to tell me where I went wrong :\ thank you!</p>