DEV Community

Cover image for ngx-awesome-popup Interactive modals on steroids πŸš€
Boris Jenicek
Boris Jenicek

Posted on β€’ Edited on

7 2

ngx-awesome-popup Interactive modals on steroids πŸš€

What is it?

It's the npm library made for the Angular 9+

What it does?

It provides:

  • Evoking dynamic components in popup
  • Toast Notifications
  • Alert Box
  • Confirm Box
  • Cookie GDPR banner

Why it is better than others?

It has:

  • Clean API
  • Better documented than others
  • Easy to use
  • d.ts files
  • Awesome snippet generator
  • Ability of global or local configuration
  • Predefined styles
  • Easy to change colors
  • Button generator
  • Simple and powerful Dependency Injection

Show me the API!

Okay

toastNotification() {
        const newToastNotification = new ToastNotificationInitializer();
        newToastNotification.setTitle('Title!');
        newToastNotification.setMessage('Message!');
        newToastNotification.setConfig({
            LayoutType: DialogLayoutDisplay.INFO // SUCCESS | INFO | NONE | DANGER | WARNING
        });
        newToastNotification.openToastNotification$();
    }
Enter fullscreen mode Exit fullscreen mode
confirmBox() {
        const confirmBox = new ConfirmBoxInitializer();
        confirmBox.setTitle('Title!');
        confirmBox.setMessage('Message!');
        confirmBox.setButtonLabels('Button1', 'Button2'); 
        confirmBox.setConfig({
            LayoutType: DialogLayoutDisplay.SUCCESS // SUCCESS | INFO | NONE | DANGER | WARNING
        });
        confirmBox.openConfirmBox$().subscribe(resp => {
            // button response
        });
    }
Enter fullscreen mode Exit fullscreen mode
dialog() {
        const dialogPopup = new DialogInitializer(AnyAngularComponent);
        dialogPopup.setCustomData({myData}); 
        dialogPopup.setConfig({
            Width     : '500px',
        );

        dialogPopup.setButtons([
            new ButtonMaker('Submit', 'submit', ButtonLayoutDisplay.SUCCESS),
            new ButtonMaker('Cancel', 'cancel', ButtonLayoutDisplay.SECONDARY)
        ]);

        dialogPopup.openDialog$().subscribe(resp => {
            // button response
        });
    }
Enter fullscreen mode Exit fullscreen mode

How does it look like?

Here's how!

Toast Notifications

Toast

Confirm box

Confirm box

Cookie banner

Cookie banner

Where to see more?

Toast - playground
Toast - StackBlitz
Confirm box - playground
Confirm box - StackBlitz
Dialog - playground

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay