Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@binssoft/ngx-dialogs

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@binssoft/ngx-dialogs

All type of dialogs in one package for angular

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@binssoft/ngx-dialogs

All type of dialogs in one package for angular

  • Simple Alert Dialog

  • Dialog with custom style

  • Dialog with custom buttons

  • Confirm Dialog

  • Dialog with static background

  • Modal Dialog

  • Lightbox Dialog

Build Status Support Support Support License

Please support this project by simply putting a Github star. Share this library with friends on Twitter and everywhere else you can.

enter image description here

Table of contents:

Getting started

Installation

npm install @binssoft/ngx-dialogs --save

Implementation

import "NgxDialogsModule" in your application module. For example: app.module.ts

import {NgxDialogsModule} from '@binssoft/ngx-dialogs';
@NgModule({
    imports :[
	    NgxDialogsModule
	    ...
    ]
})
export class AppModule { }

add configration in your component. For example : MyOwn.component.ts

import {NgxDialog} from '@binssoft/ngx-dialogs';

export  class  MyOwnComponent  implements  OnInit {
    constructor(
	    private alert :  NgxDialogs
    ) { }
}
Simple Alert Dialog
this.alert.create({
    title: 'Simple Dialog',
    message: 'It is a simple alert dialog',
}, ()=>{ alert('after close') });
Dialog with custom style
this.alert.create({
    title: 'Custom style Dialog',
    message: 'It is a custom style alert dialog',
    customCssClass: 'custom-alert'
}, ()=>{ alert('after close') });
Dialog with custom buttons
this.alert.create({
    title: 'Dialog with Buttons',
    message: 'It is a alert box with buttons',
    buttons : [
		    {
			    title : 'Ok',
			    class: 'ok-btn',
			    event : ()=>{
				    alert('you press ok');
			    }
		    },
		    {
			    title : 'Yes',
			    class: 'yes-btn',
			    event : ()=>{
				    alert('you press yes');
			    }
		    },
		    {
			    title : 'No',
			    class: 'no-btn',
			    event : ()=>{
			    alert('you press No');
		    }
	    }
    ]
});
Confirm Dialog
this.alert.create({
    title: 'Confirm Dialog',
    message: 'It is a confirm dialog box',
    confirm: ()=> {
	    alert('you click "yes"');
    },
    cancel: ()=> {
	    alert('you click "cancel"');
    },
});
Dialog with static background
this.alert.create({
    title :'Dialog with static background',
    message : 'It is a dialog with static backgrond. only close by clicking on "x" ',
    strict: true
});
Modal Dialog
export class MyOwnComponent implements OnInit {
    modalDialogConfig: any = {};
    openModalDialog() {
	    this.modalDialogConfig = {};
	    this.modalDialogConfig['title'] = 'Simple Modal';
	    this.modalDialogConfig['type'] = 'M';
	    this.modalDialogConfig['strict'] = true;
    }
}
HTML
<a href="javascript:void(0)" (click)="openModalDialog()">Click HERE </a>
<ngx-dialogs [config]="modalDialogConfig">
    <p>It is a modal dialog</p>
    <button (click)="openAlertWithButton()">Open Simple Alert</button>
</ngx-dialogs>
Image Lightbox Dialog
openLightBoxDialog() {
	this.alert.create({
    	"src": 'path/to/big/image/img.jpg'
	});
}
HTML
<img title="Click to open light box" src="path/to/thumb/img-thumb.jpg" (click)="openLightBoxDialog()"/>
Close Dialog dynamiclly
this.alert.remove();

Settings Option

NameDescriptionDefault ValueExampleMandatory
titleto display the heading of the dialogNULL'title':'Sample Heading'NO
messageto display the message of the dialogNULL'message':'Message of the alert box'YES
verticalAlignto set vertical position of dialogNULL'verticalAlign':'top/end'NO
durationto set to close dialog autmatically after nth SecNULL'duration':nth(s)NO
iconto display icon within the dialogNULL'icon':success/error/info/warningNO
srcto add the image path for lightbox dialogNULL'src':'http://test-domain/img.jpg'YES(if it is a image lightbox dialog)
strictto make the dialog background staticfalse'strict': trueNO
customCssClassto add custom css clas with the dialogNULL'customCssClass': 'custom-dialog'NO
typeto manage the dialog width'S''type': 'S/M/L/XL' NO
confirmevent only for confirm dialog()=>{}confirm:()=>{ alert('click on confirm'); }YES(if you want confirm message box)
buttonsto manage multiple custom buttons in the dialog[]buttons : [ {title : 'Ok',class: 'ok-btn',event : ()=>{alert('you press ok');}},]NO
buttons.titleto add the text of the button'OK'buttons : [ {title : 'Ok'}]YES
buttons.classto add the custom class of the button'ok-btn'buttons : [ {class : 'ok-btn'}]NO
buttons.eventevent of the perticular button()=>{}buttons : [ {event : ()=>{alert('you press ok');}}]YES

Demo

Click Here for the demo

Creator

Tonmoy Nandy

License

The MIT License (MIT)

Keywords

angular ng dialog modal confirm alert

Keywords

FAQs

Package last updated on 25 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc