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

ngx-toaster not imported in angular 17 #1011

Open
ekta-rupareliya opened this issue Dec 27, 2023 · 3 comments
Open

ngx-toaster not imported in angular 17 #1011

ekta-rupareliya opened this issue Dec 27, 2023 · 3 comments

Comments

@ekta-rupareliya
Copy link

if we install ngx-toaster and import in angular 17 then import in standalone component but not working

@component({
selector: 'app-notification',
standalone: true,
imports: [PageTitleComponent, ToastrModule.forRoot()],
templateUrl: './notification.component.html',
styles: ``
})

@rickardaniel
Copy link

I had the same problem, however i could solve. You should import
providers: [
provideAnimations(),
provideToastr(),
]
In app.config.ts,
in the app.component.ts you don't import nothing
Now in your component where you call the toast, you should continue work as the same

@prokopec-simon
Copy link

Even with @rickardaniel 's tip I still get "Type 'EnvironmentProviders' is not assignable to type 'Provider'." error. Anyone has any tips on how to fix this? Thank you.

@rickardaniel
Copy link

I'm working with:
Angular CLI : 17.0.8
Angular: 17.0.8
Node: 20.10.0
npm: 10.2.5
TypeScript: 5.2.2
ngx-toastr: ^17.0.2

You should add @import 'ngx-toastr/toastr'; in the file styles.scss, Also try to work the toast services in another file

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