sweetalert2 / ngx-sweetalert2

Declarative, reactive, and template-driven SweetAlert2 integration for Angular
MIT License
652 stars 94 forks source link

feat: upgrade to angular 16 with standalone support #239

Closed steve3d closed 1 year ago

steve3d commented 1 year ago

Angular 16 has been released. And in angular 15.2, the standalone was production ready.

So I created a new provideSweetalert2 function to use with these standalone applications. Because of the nature of sweetalert2, I don't think change SwalComponent, SwalPortalDirective, to standalone is a good idea, because these two are bounded together, but SwalDirective can be standalone.

Angular 16 also changed module target to ES2022, So I also updated the tsconfig.json and angular.json to meet the latest version of angular. So this version should only support angular 16+.

Hoping this will be released soon.

steve3d commented 1 year ago

Sorry, I just found out that [swal] directive can not be standalone, because it might need SwalComponent.

steve3d commented 1 year ago

I have an complete rewritten version of this package, and the component/directive are all standalone, I also changed a lot of implementation, and matching the latest angular changes, removed the SweetAlert2LoaderService SwalPortalComponent and SwalPortalTargets, it's much easier to understand the code now.

If you have time, you might want to checkout my version: https://github.com/steve3d/ngx-sweetalert2-standalone

because this version only works with angular 16(esm format change), So I'm not sure if I can create such big change PR.

limonte commented 1 year ago

Hey @steve3d and sorry for the huge delay in my response!

I just merged #245 because it looks simple and will work for our users without breaking changes.

I guess you're also good and using @vrdd/ngx-sweetalert2.

Thank you for the contribution and sorry that it wasn't merged!