All Projects → shlomiassaf → Ngx Modialog

shlomiassaf / Ngx Modialog

Licence: mit
Modal / Dialog for Angular

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Modialog

ngx-modal
Dynamic modal dialog for Angular
Stars: ✭ 54 (-92.19%)
Mutual labels:  modal, dialog
Vodal
A Vue modal with animations.
Stars: ✭ 312 (-54.85%)
Mutual labels:  dialog, modal
bootstrap-modal-wrapper
Bootstrap modal factory that supports dynamic modal creations and nested stacked modal features.
Stars: ✭ 18 (-97.4%)
Mutual labels:  modal, dialog
react-fusionui
☢️ Nuclear power-up for your UI.
Stars: ✭ 13 (-98.12%)
Mutual labels:  modal, dialog
Gijgo
Gijgo - Free Javascript Controls
Stars: ✭ 424 (-38.64%)
Mutual labels:  dialog, modal
plain-modal
The simple library for customizable modal window.
Stars: ✭ 21 (-96.96%)
Mutual labels:  modal, dialog
Vue Modal Dialogs
Promisify dialogs in Vue!
Stars: ✭ 259 (-62.52%)
Mutual labels:  dialog, modal
angular-custom-modal
Angular2+ Modal / Dialog (with inner component support).
Stars: ✭ 30 (-95.66%)
Mutual labels:  modal, dialog
Rmodal.js
A simple 1.2 KB modal dialog with no dependencies
Stars: ✭ 613 (-11.29%)
Mutual labels:  dialog, modal
React Native Actions Sheet
A Cross Platform(Android & iOS) ActionSheet with a flexible api, native performance and zero dependency code for react native. Create anything you want inside ActionSheet.
Stars: ✭ 412 (-40.38%)
Mutual labels:  dialog, modal
jquery.dialog.js
A lightweight replacement for the browser's default dialog boxes.
Stars: ✭ 17 (-97.54%)
Mutual labels:  modal, dialog
Ngx Sweetalert2
Declarative, reactive, and template-driven SweetAlert2 integration for Angular
Stars: ✭ 503 (-27.21%)
Mutual labels:  dialog, modal
svelte-accessible-dialog
An accessible dialog component for Svelte apps
Stars: ✭ 24 (-96.53%)
Mutual labels:  modal, dialog
Sweetalert
A beautiful replacement for JavaScript's "alert"
Stars: ✭ 21,871 (+3065.12%)
Mutual labels:  dialog, modal
wechat-miniprogram-dialog
微信小程序弹窗组件 wxapp dialog component
Stars: ✭ 50 (-92.76%)
Mutual labels:  modal, dialog
Ngx Smart Modal
Modal/Dialog component crafted for Angular
Stars: ✭ 256 (-62.95%)
Mutual labels:  dialog, modal
eins-modal
Simple to use modal / alert / dialog / popup. Created with pure JS. No javascript knowledge required! Works on every browser and device! IE9
Stars: ✭ 30 (-95.66%)
Mutual labels:  modal, dialog
react-redux-modal-flex
[DEPRECATED] Make easy a modal/popup with Redux
Stars: ✭ 14 (-97.97%)
Mutual labels:  modal, dialog
Popupdialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
Stars: ✭ 3,709 (+436.76%)
Mutual labels:  dialog, modal
React Cool Portal
😎 🍒 React hook for Portals, which renders modals, dropdowns, tooltips etc. to <body> or else.
Stars: ✭ 458 (-33.72%)
Mutual labels:  dialog, modal

ngx-modialog (previously angular2-modal)


This project is looking for a new maintainer, see #414 for details.


ngx-modialog version 5.x.x works with angular 5.x.x

IMPORTANT - V4 BREAKING CHANGE:

Version 4.x.x contains some breaking changes, please see the CHANGELOG

Library has been renamed from version 3.0.2

Modal / Dialog implementation for angular.

  • Easy to use API via Fluent API Presets (alert, prompt, confirm)
  • Can render Component's, TemplateRef's and literal string
  • Extendable via plugins.
  • Easy to use
modal.alert()
    .title('Hello World')
    .body('In Angular')
    .open();

Available plugins:

Install

npm install ngx-modialog

Basic plunker playground (bootstrap plugin):

ngx-modialog @ 4.x.x

http://plnkr.co/edit/lV7zsw7Yqossgs9JOfQU?p=preview

ngx-modialog @ 3.x.x

http://plnkr.co/edit/2ppVYl517GI1Byv8vVbG?p=preview

Quick start

In your application root module definition add ModalModule and the plugin you want to use:

We will use the bootstrap plugin (BootstrapModalModule) for this introduction.

import { ModalModule } from 'ngx-modialog';
import { BootstrapModalModule } from 'ngx-modialog/plugins/bootstrap';

// lots of code...

@NgModule({
  bootstrap: [ /* ... */ ],
  declarations: [ /* ... */ ],
  imports: [
    /* ... */
    ModalModule.forRoot(),
    BootstrapModalModule
  ],
})
export class AppModule { /* lots of code... */ }

In any angular component or service inject the Modal service and open a modal:

import { Component, ViewContainerRef } from '@angular/core';
import { Overlay } from 'ngx-modialog';
import { Modal } from 'ngx-modialog/plugins/bootstrap';

@Component({
  selector: 'my-app',
  template: `<button (click)="onClick()">Alert</button>`
})
export class AppComponent {
  constructor(public modal: Modal) { }

  onClick() {
    const dialogRef = this.modal.alert()
        .size('lg')
        .showClose(true)
        .title('A simple Alert style modal window')
        .body(`
            <h4>Alert is a classic (title/body/footer) 1 button modal window that 
            does not block.</h4>
            <b>Configuration:</b>
            <ul>
                <li>Non blocking (click anywhere outside to dismiss)</li>
                <li>Size large</li>
                <li>Dismissed with default keyboard key (ESC)</li>
                <li>Close wth button click</li>
                <li>HTML content</li>
            </ul>`)
        .open();

    dialogRef.result
        .then( result => alert(`The result is: ${result}`) );
  }
}

If you are using ngx-modialog version 3.X.X or below, open() returned a promise so replace the last 2 lines with:

   dialogRef
       .then( dialogRef => {
           dialogRef.result.then( result => alert(`The result is: ${result}`);
       });

We are using the alert() method, one of 3 (prompt, confirm)) fluent-api methods we call drop-ins

We then use the result property to wait for the modal closing event.

Notes:

  • Fluent API methods (drop-ins) are pre-configured (presets) methods that allow easy configuration and execution, you can create custom presets - see the demo application.
  • For more control use the open() method, which is used by all drop in's internally.
  • We import the Modal service from the plugin and not from the root library. Import from the root should work but being explicit allow using multiple plugins.

Demo App

The Demo application is a full implementation of the library with the native plugins.

View it at shlomiassaf.github.io/ngx-modialog

The demo application is part of this repository and it is a great place to learn by example.

Bootstrap / VEX features:

  • Customizable with components, Presets and more...
  • Select cancel/quit key.
  • Cascading modals.
  • Element blocking.
  • Blocking / Non blocking modal.
  • Modal as a component, replace the content by supplying a custom component.

The demo application comes with a dynamic modal generator for the Boostrap plugin

Plugins

Plugins serve as a concrete UI implementation for a modal.

It can be an implementation for a known library (e.g: bootstrap) or something completely unique

While ngx-modialog has some built in plugins it is also possible to use external plugins from NPM, if someone decide to build one.

Built a plugin? I would love to know :)

Known bugs

The dialog closes when removing the target DOM element in a click event

ref issue#111

To avoid this problem use event.stopPropagation(); or put the element removal inside a setTimeout call


HELP WANTED!

As a sole author I find it difficult to maintain multiple open source projects. As a result it is hard for me to replay rapidly to requests/help/etc...

If you would like to contribute, please contact me, the community will thank you.

You can contribute via:

  • Implementing features & Bug fixes
  • Documentation (Extremely important)
  • Issue management

Thank you!

Shlomi.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].