title: TypeError: source.subscribe is not a function in app.component / Ionic 5
body: <p>In my app. I have a side menu where you can see the name of the user and profile, if you click a button, it takes you to the profile page where I can update the info. I am saving the user info in a user service, and I am having a hard time passing the user info into the app.component so that I can populate the side menu. I am trying to use observables. Apparently, the problem is with the logged.subscribe function.</p>
  <p>My AuthService</p>
  <pre><code>import { Injectable } from '@angular/core';
  import { BehaviorSubject } from 'rxjs';
  
  @Injectable({
    providedIn: 'root'
  })
  export class AuthService {
    private _userIsAuthenticated = new BehaviorSubject&lt;boolean&gt;(false);
  
    constructor() { }
  
    get userIsAuthenticated(){
      return this._userIsAuthenticated.asObservable;
    }
  
    login(){
      this._userIsAuthenticated.next(true);
    }
  
    logout(){
      this._userIsAuthenticated.next(false);
    }
  
  }
  </code></pre>
  <p>My UserService</p>
  <pre><code>import { Injectable } from '@angular/core';
  import { BehaviorSubject } from 'rxjs';
  import { take, map, tap, delay } from 'rxjs/operators';
  
  import { User } from '../model/user.model';
  
  @Injectable({
    providedIn: 'root'
  })
  export class UserService {
    private _loggedUser = new BehaviorSubject&lt;User&gt;(
      new User(null, null, null, null, null, null, null)
    );
  
    constructor() { }
  
    get loggedUser(){
      return this._loggedUser.asObservable;
    }
  
    setUser(sentUser: User){
      this._loggedUser.next(sentUser);
    }
  
    rmUser(){
      this._loggedUser.next(new User(null, null, null, null, null, null, null));
    }
  }
  </code></pre>
  <p>This is my app.component</p>
  <pre><code>import { Component } from '@angular/core';
  import { Router } from '@angular/router';
  import { MenuController } from '@ionic/angular';
  import { Platform } from '@ionic/angular';
  import { SplashScreen } from '@ionic-native/splash-screen/ngx';
  import { StatusBar } from '@ionic-native/status-bar/ngx';
  import { Observable } from 'rxjs';
  
  import { AuthService } from './services/auth.service';
  import { UserService } from './services/user.service';
  import { User } from './model/user.model';
  
  @Component({
    selector: 'app-root',
    templateUrl: 'app.component.html',
    styleUrls: ['app.component.scss']
  })
  export class AppComponent {
    private logged: Observable&lt;boolean&gt;;
    private user: User;
  
    constructor(
      private platform: Platform,
      private splashScreen: SplashScreen,
      private statusBar: StatusBar,
      private router: Router,
      private menuCtrl: MenuController,
      private as: AuthService,
      private us: UserService,
    ) {
      this.logged = this.as.userIsAuthenticated();
      this.initializeApp();
      this.setUser();
    }
  
    initializeApp() {
      this.platform.ready().then(() =&gt; {
        this.statusBar.styleDefault();
        this.splashScreen.hide();
      });
    }
  
    private setUser(){
      // console.log(this.logged.subscribe);
      this.logged.subscribe(v =&gt; {      
        if (v) {
          this.us.loggedUser().subscribe(user =&gt; {
            this.user = user;
          })
        }
      })
    }
  
    logout(){
      this.menuCtrl.close();
      this.as.logout();
      this.router.navigate(['/']);
    }
  
    profile(){
      this.menuCtrl.close();
      this.router.navigate(['/user/perfil']);
    }
  
    profilePro(){
      this.menuCtrl.close();
      this.router.navigate(['profesional/perfil']);
    }
  }
  </code></pre>
  <p>The app wont compile, and i get this error</p>
  <pre><code>TypeError: source.subscribe is not a function
  at Observable._subscribe (Observable.js:76)
  at Observable.subscribe (Observable.js:27)
  at AppComponent.setUser (app.component.ts:45)
  at new AppComponent (app.component.ts:33)
  at NodeInjectorFactory.AppComponent_Factory [as factory] (ɵfac.js? [sm]:1)
  at getNodeInjectable (core.js:4029)
  at instantiateRootComponent (core.js:7826)
  at createRootComponent (core.js:18375)
  at ComponentFactory$1.create (core.js:22191)
  at ApplicationRef.bootstrap (core.js:28319)
  </code></pre>
  <p>I have been reading around and it seems I have setup everything correctly. Any help or any tips to ompimizea and better the code in general, would be appreciated. Thanks</p>