Angular - Advanced Patterns
This Angular code tries to implement the Observer pattern but has a bug:
What is the bug and how to fix it?
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class LoggerService {
private logSubject = new Subject();
log$ = this.logSubject.asObservable();
logMessage(message: string) {
this.logSubject.next;
}
} What is the bug and how to fix it?
