Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

358
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!