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 working in angular 16.0 #272

Open
madhurakhal opened this issue May 3, 2023 · 2 comments
Open

Not working in angular 16.0 #272

madhurakhal opened this issue May 3, 2023 · 2 comments

Comments

@madhurakhal
Copy link

image

@selangley-wa
Copy link

selangley-wa commented May 26, 2023

It will not work in Angular 16 until such time that the library is migrated to build with Ivy. With Angular 16, they decided to finally remove all compatibility with the older type of modules using the View engine.

https://angular.io/guide/update-to-version-16#angular-compatibility-compiler-ngcc-has-been-removed

Angular Compatibility Compiler (ngcc) has been removed

The Angular Compatibility Compiler (ngcc) was a build tool that facilitated compatibility between Angular's previous compiler and rendering architecture (View Engine) and its new architecture (Ivy).

View Engine was removed in Angular v13, and v16 finally removes ngcc. As a result, Angular libraries built with View Engine cannot be used in Angular v16+.

If this package does not get updated to support Ivy, you will need to remove this library for any project using Angular 16 or later.

Possible alternative libraries are:

https://www.npmjs.com/package/ngx-toastr
https://www.npmjs.com/package/@sweetalert2/ngx-sweetalert2
https://material.angular.io/components/snack-bar/overview
The next one is not distributed as a library but as tutorial/example of how to do it yourself, but focused on just "alerts"
https://jasonwatmore.com/angular-15-free-course-5-alerts-home-page

Update:
There are now two forks of this project that have both released npm packages that supposedly work with Angular 16 and Ivy:

https://github.com/ShacharHarshuv/Angular2-Toaster
https://www.npmjs.com/package/angular2-toaster-2

https://github.com/dmkachko/Angular2-Toaster
https://www.npmjs.com/package/@dkachko/angular2-toaster

@Stabzs

@selangley-wa
Copy link

After spending some time looking at each of the alternative libraries I listed above, I think:
https://www.npmjs.com/package/ngx-toastr
provides the closest to a "drop-in replacement" for Angular2-Toaster

It has a somewhat different API, but most of the same functionality and configuration options as Angular2-Toaster. Additionally, it appears to be well-maintained with regular releases tracking the pace of Angular development and with a number of developers contributing to the project.

Depending on which version you use, you may want to take a look at the answers to this stack overflow question for guidance:
https://stackoverflow.com/questions/72473119/place-toastr-toasts-in-container-in-specific-component

SweetAllert2 and Angular Materials Snackbar component both provide toaster-like functionality, but that is not their main focus.
Also, they both explicitly state that they do not support displaying more than one toast on the screen at once.

sweetalert2/sweetalert2#2383
Display multiple toasts? #2383

angular/material#2799
$mdToast is supported multiple 'toast' at same time? #2799

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

2 participants