Q:

BehaviorSubject between components on route change

My observable is not triggered on route change.
I have a behaviorSubject in my service.
import { Injectable } from '@angular/core';
import { Observable, BehaviorSubject } from 'rxjs';
import { map } from 'rxjs/operators';
import { Rooms } from '../../models/Rooms';
import { UsersService } from '../users/users.service';

@Injectable()
export class RoomsService {
    roomsModel: Rooms
    private _roomsSubject: BehaviorSubject<Rooms> 
    rooms$: Observable<Rooms>

    constructor(private usersService: UsersService ) {
        this._roomsSubject = new BehaviorSubject<Rooms>(this.roomsModel)
        this.rooms$        = this._roomsSubject.asObservable()
    }
}

When I subscribe to it on the components (waiting component), the subscribtion is triggered and I have the object.
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { UsersService } from 'src/app/services/users/users.service';
import { RoomsService } from 'src/app/services/rooms/rooms.service';
import { Rooms } from 'src/app/models/Rooms';
import { Users } from 'src/app/models/Users';

@Component({
  selector: 'app-waiting',
  templateUrl: './waiting.component.html',
  styleUrls: ['./waiting.component.scss']
})
export class WaitingComponent implements OnInit {

  isHost: boolean
  room: Rooms
  users: Users[]

  constructor(private route: ActivatedRoute, private userService: UsersService, private roomsService: RoomsService) { }

  ngOnInit() {
    this.isHost = (this.route.snapshot.params['host'] == "true")?true:false

    if(this.isHost){
      this.roomsService.createRoom()
    }

    this.roomsService.rooms$.subscribe(room => {
      console.log(room) 
      this.room = room; 
    })    
  }

}

but from another component (join component) I'm redirected to this component, the subscription to this observable is not triggered.
My source is here : 
https://plnkr.co/edit/q2x9z9vPe5ZFyKcb1XUo

A:

Your plunkr is not working, but I can see the code. You need to remove the providers: [ RoomsService ] from the AppComponent declaration. It's causing multiple instances of the RoomsService. Another way would be to remove it also from the NgModule.providers and add:
@Injectable({
    providedIn: 'root'
})
export class RoomsService {}

Also, you are reassigning your this.rooms$ property in getRoom with return this.rooms$ = this.roomsCollection. This is probably not what you want

