title: Exception: ObjectUnsubscribedError when working with Observables with RxJS and Angular2
body: <p>I am still trying to teach myself Angular2 (and I really need to find some better resources) but I have a question. I have moved my data calls to a service and I am using Reactive Subject &amp; BehaviorSubject after instruction from a friend. My calls works, I have a mock REST service from a real back end that gives me a data object (that is an oject of mock user data), my response matches a type I have defined however in my top level app (called App.ts) I have to wait for the response. Now this is where I am doing something wrong as when I try to obtain or work with the data I get <code>[Exception: ObjectUnsubscribedError]</code> when I <code>console.log</code>.</p>
  
  <p>Here's the problem, here is my top level app</p>
  
  <pre><code>import {Component} from 'angular2/core';
  import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
  import {Observable, Subject, BehaviorSubject} from 'rxjs';
  import {UserContact, UserStatus} from './types/types';
  
  // more stuff, then...
  
  import {UserDataService} from './services/user-data/UserDataService';
  
  @Component({
      selector: 'app',
      providers: [...FORM_PROVIDERS, UserDataService],
      directives: [...ROUTER_DIRECTIVES, FooterNavigation, TopNavigation, ContactsList],
      pipes: [],
      template: require('./app.html')
  })
  
  export class App {
  
      constructor(public userDataService: UserDataService) {
          console.log(this.userDataService.loginInUser.last());
      }
  
      ngOnInit() {
          // even if I try to output here I get the same problem
      }
  }
  </code></pre>
  
  <p>Here is my UserDataService</p>
  
  <pre><code>import {Injectable} from 'angular2/core';
  import {UserStatus} from '../../types/types';
  import {Subject, BehaviorSubject, Observable} from 'rxjs';
  import {Http, Headers, Response} from 'angular2/http';
  
  @Injectable()
  export class UserDataService {
  
      public loginInUser: Subject&lt;UserStatus&gt; = new BehaviorSubject&lt;UserStatus&gt;(null);
      public currentUser: UserStatus;
  
      constructor(public http:Http) {
          this.loadUserStatus(); // Here I define the false user to use in my App
      }
  
      private loadUserStatus():void {
          var headers = new Headers();
          headers.append('Content-Type', 'application/json');
          this.http.get('/restservice/userstatus', {headers: headers}).subscribe((response:Response) =&gt; {
              var userStatus: UserStatus = new UserStatus(response.json());
              this.currentUser = userStatus;
              this.loginInUser.next(this.currentUser);
          }, (error:Response) =&gt; this.handleError, () =&gt; {
              this.loginInUser.complete();
          });
      }
  </code></pre>
  
  <p>The results from the <code>console.log(this.userDataService.loginInUser.last());</code> in the App.ts gives me the following:</p>
  
  <pre><code>_isScalar: false
  completeSignal: false
  destination: BehaviorSubject
  dispatching: false
  errorSignal: false
  isUnsubscribed: false
  observers: Array[0]
  operator: LastOperator
  source: BehaviorSubject
  _hasError: false
  _isScalar: false
  _subscriptions: undefined
  _value: UserStatus // the data does seem to be here!!!!
  completeSignal: true
  dispatching: false
  errorSignal: false
  isUnsubscribed: true
  observers: undefined
  value: [Exception: ObjectUnsubscribedError] // Here is the problem!!!!
  </code></pre>
  
  <p>I just want my App.ts to receive the returned data once it is ready, it obviously isn't updating... please tell me what I am doing wrong I have waisted hours on this!</p>