Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

361
Vistas
ERROR Error: No provider for ToastsManager

I am trying to display a toaster notification inside a component. But I am getting this error.

ERROR Error: No provider for ToastsManager!

Following is the code for my component.

import { Component, ElementRef, OnInit, ViewContainerRef } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import * as fullscreen from 'screenfull';
import DataService from '../../services/data.service';
import { ToastsManager } from 'ng2-toastr/ng2-toastr';

export interface IProgress {
    completed?: boolean;
    customData?: any;
    position?: number;
}

@Component({
    selector: 'player',
    template: require('./player.component.html'),
})

export default class Player implements OnInit {
    public fileId: string;
    public token : string;
    public file: any;
    public error: any;
    public loaded: boolean = false;
    public progress: IProgress;

    constructor(
        private elementRef: ElementRef,
        private dataService: DataService,
        private toastr: ToastsManager,
        private vcr: ViewContainerRef
    ) {
        this.toastr.setRootViewContainerRef(vcr);
    }

    // Other functions
}

I think there is a problem with injecting ToastsManager but I can not figure out what has gone wrong.

Can someone please help me?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Make sure right imports have been made.

@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    BrowserAnimationsModule, // required animations module
    ToastrModule.forRoot(), // ToastrModule added
  ],
  declarations: [AppComponent, HelloComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda