Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not found ToastContainerModule #1020

Open
phamngocchauanh opened this issue Jul 12, 2024 · 2 comments
Open

Not found ToastContainerModule #1020

phamngocchauanh opened this issue Jul 12, 2024 · 2 comments

Comments

@phamngocchauanh
Copy link

I follow readme Put toasts in your own container (https://www.npmjs.com/package/ngx-toastr), but not found ToastContainerModule please check

@abudygold
Copy link

I follow readme Put toasts in your own container (https://www.npmjs.com/package/ngx-toastr), but not found ToastContainerModule please check

I tried to import the ToastContainerDirective and it's solved bro.
Follow code in the below

import { ToastContainerDirective, ToastrService } from 'ngx-toastr';

@Component({
	standalone: true,
	imports: [
		ToastContainerDirective,
	],
})

export class MainLayoutComponent implements OnInit {
	@ViewChild(ToastContainerDirective, { static: true })
	toastContainer!: ToastContainerDirective;

	constructor(
		private _toastrService: ToastrService
	) {}

	ngOnInit() {
		this._toastrService.overlayContainer = this.toastContainer;
	}
}

@Pedro-Magalhaes
Copy link

Pedro-Magalhaes commented Dec 9, 2024

Had this issue when I updated from the version 13 to the version 17 and importing the directive instead of the module, as described by @abudygold, worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants