npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mr-samani/ngx-dialog

v1.0.0

Published

open angular component as dialog

Readme

NgxDialog

🎉 Open angular component as a dialog(popup) in Angular Framework without Cdk Material

📦Demo

🚀demo

Install

  • NPM: npm i @mr-samani/ngx-dialog
  • YARN: yarn add @mr-samani/ngx-dialog

Usage

Import NgxDialogModule to your working module

import { NgxDialogModule } from  'ngx-dialog';

@NgModule({
  imports: [
    NgxDialogModule 
  ]
})
export class AppModule { }

For open dialog

import { Component, OnInit } from '@angular/core';
import { NgxDialogService } from 'ngx-dialog';
import { ModalComponent } from './modal/modal.component';

@Component({
  selector: 'app-demo',
  templateUrl: './demo.component.html',
  styleUrls: ['./demo.component.scss']
})
export class DemoComponent implements OnInit {

  constructor(
    private ngxDialog: NgxDialogService
  ) { }

  ngOnInit(): void {
  }


  openDialog() {
    this.ngxDialog.open(ModalComponent, {
      data: {
        a: 123
      },
      containerClass: 'my dialog ',
      allowCloseOnOutsideClick: true,
      maxWidth: '80%',
      maxHeight: '80%'
    }).afterClosed.subscribe((r: any) => {
      console.log('closed result=', r);
    });
  }

}

Modal component

import { JsonPipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { NgxDialogConfig, NgxDialogRef, NgxDialogService } from 'ngx-dialog';

@Component({
  selector: 'app-modal',
  templateUrl: './modal.component.html',
  styleUrls: ['./modal.component.scss']
})
export class ModalComponent implements OnInit {
  data: any;
  constructor(
    public config: NgxDialogConfig, 
    public dialogRef: NgxDialogRef,
    private ngxDialog: NgxDialogService
  ) {
    this.data = config.data;
  }

  ngOnInit(): void {
  }

  ok() {
    alert('param=' + new JsonPipe().transform(this.data));
  }

  cancel() {
    this.dialogRef.close(this.data);
  }


  openNewDialog() {
    this.ngxDialog.open(ModalComponent, {
      data: {
        a: this.data.a + 1
      }
    }).afterClosed.subscribe((r: any) => {
      console.log('child closed result=', r);
    });
  }

}

Modal html

<div ngx-dialog-header [showCloseButton]="true">
    header
</div>
<div ngx-dialog-body>
    <p>modal works!</p>
    {{data|json}}
</div>
<div ngx-dialog-footer [align]="'space-between'">
    <div>
        <button (click)="ok()" type="button" class="btn btn-primary mx-1">ok</button>
        <button (click)="cancel()" type="button" class="btn btn-warning mx-1">cancel</button>
    </div>

    <button (click)="openNewDialog()" type="button" class="btn btn-info mx-1">open New Dialog</button>
</div>

For create draggable dialog:

you can use NgxDragableResizable library 🚀npm and change dialog header to:

 <div ngx-dialog-header [showCloseButton]="true" NgxDragableResizable [dragRootElement]="'.ngx-dialog'">
       header
 </div> 

Dialog config

| Name |Type|Default| Description | |--|--|--|--| |[data]|any|{}| Pass data to modal component | |[allowCloseOnOutsideClick]|boolean|false|The user can close the modal by clicking outside the modal| |[containerClass]|string|null|Css class name| |[header]|string|null|Header config| |[footer]|string|null|Footer config| |[width]|string|""|Width of dialog| |[minWidth]|string|""|Minimum width of dialog| |[maxWidth]|string|""|Maximum width of dialog| |[height]|string|""|Height of dialog| |[minHeight]|string|""|Minimum height of dialog| |[maxHeight]|string|""|Maximum height of dialog|

Author

💻Mohammadreza samani | FrontEnd Developer

❤️Buy me a coffee 😉