Example code for Toastr
Author: EdminssonCreated Jul 16, 2026Updated Jul 16, 2026
In the overview of the Toastr Component you suggest this service:
@Service()
export class AppToastService {
private readonly _toasts = signal<ToastInfo[]>([]);
readonly toasts = this.toasts.asReadonly();
show(header: string, body: string) {
this._toasts.push({ header, body });
}
}The declaration of toasts references itself and should reference this._toasts. In the show method you call this._toasts.push but a signal does not have a push method.
Source: ng-bootstrap/ng-bootstrap