All Projects → caroso1222 → Ng Popups

caroso1222 / Ng Popups

Licence: mit
🎉 Alert, confirm and prompt dialogs for Angular. Simple as that.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ng Popups

Alertifyjs
A javascript framework for developing pretty browser dialogs and notifications.
Stars: ✭ 1,922 (+2302.5%)
Mutual labels:  prompt, dialog, modal, alert
react-st-modal
Simple and flexible modal dialog component for React JS
Stars: ✭ 41 (-48.75%)
Mutual labels:  alert, modal, dialog, prompt
jquery.dialog.js
A lightweight replacement for the browser's default dialog boxes.
Stars: ✭ 17 (-78.75%)
Mutual labels:  alert, modal, dialog, prompt
Sweetalert2
A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
Stars: ✭ 13,929 (+17311.25%)
Mutual labels:  prompt, dialog, alert
Smalltalk
Promise-based Alert, Confirm and Prompt replacement
Stars: ✭ 76 (-5%)
Mutual labels:  prompt, modal, alert
Wc Messagebox
基于 Vue 2.0 开发的 Alert, Toast, Confirm 插件, UI仿照 iOS 原生
Stars: ✭ 203 (+153.75%)
Mutual labels:  dialog, modal, alert
Pmalertcontroller
PMAlertController is a great and customizable alert that can substitute UIAlertController
Stars: ✭ 2,397 (+2896.25%)
Mutual labels:  dialog, modal, alert
svelte-accessible-dialog
An accessible dialog component for Svelte apps
Stars: ✭ 24 (-70%)
Mutual labels:  alert, modal, dialog
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 (-62.5%)
Mutual labels:  alert, modal, dialog
Sweetalert
A beautiful replacement for JavaScript's "alert"
Stars: ✭ 21,871 (+27238.75%)
Mutual labels:  dialog, modal, alert
React Native Alert Pro
The Pro Version of React Native Alert (Android & iOS)
Stars: ✭ 69 (-13.75%)
Mutual labels:  dialog, modal, alert
Alertjs
Dialog Builder allows you to create fully customisable dialogs and popups in Dynamics 365.
Stars: ✭ 80 (+0%)
Mutual labels:  prompt, dialog, alert
Nativepopup
Clone of Apple iOS App's feedback popup, and easily customizable.
Stars: ✭ 247 (+208.75%)
Mutual labels:  dialog, modal, alert
mobile-message
基于移动端的弹窗组件,默认提供info、success、warning、error、alert、confirm、multiple、vertical、bottomSheet、prompt,可自定义弹窗。它可以包含任何Html内容可以自定义弹窗的样式,也可以加入自定以的弹窗动画。
Stars: ✭ 13 (-83.75%)
Mutual labels:  alert, dialog, prompt
Razor.SweetAlert2
A Razor class library for interacting with SweetAlert2
Stars: ✭ 98 (+22.5%)
Mutual labels:  alert, dialog, prompt
react-redux-modal-flex
[DEPRECATED] Make easy a modal/popup with Redux
Stars: ✭ 14 (-82.5%)
Mutual labels:  alert, modal, dialog
Customalertviewdialogue
Custom AlertView Dialogue is the world's most advanced alert view library. Custom AlertView Dialogue includes simple message popups, confirmation alerts, selector popups, action sheet bottom menus, and input/feedback contact forms.
Stars: ✭ 100 (+25%)
Mutual labels:  dialog, modal, alert
Bdialog
Extend the Bootstrap Modal features, making dialog more functions and easier to use, dialog type including modal, alert, mask and toast types
Stars: ✭ 174 (+117.5%)
Mutual labels:  dialog, modal, alert
Popupdialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
Stars: ✭ 3,709 (+4536.25%)
Mutual labels:  dialog, modal, alert
Vuejs Dialog
A lightweight, promise based alert, prompt and confirm dialog
Stars: ✭ 327 (+308.75%)
Mutual labels:  prompt, dialog, alert

NgPopups

npm version MIT PRs Build Status

Alert, confirm and prompt dialogs for Angular


Demo: https://ng-popups.carlosroso.com/

This repo was formerly known as ngx-cool-dialogs.

Features

  • 🎩 Cross browser compatible
  • 📱 Responsive
  • 🐥 Easy to use
  • 🔥 Highly configurable
  • 👀 Good a11y and i18n support
  • 💥 Support for Angular v9 and v10

Installation

npm i ng-popups @angular/cdk

Usage

Basic

  1. Add the NgPopupsModule to your core module (e.g. app.module.ts). You can optionally pass a config object as the parameter of the forRoot method.
import { NgPopupsModule } from 'ng-popups';

@NgModule({
  ...,
  imports: [
    ...,
    NgPopupsModule.forRoot(globalConfig)
  ],
  ...
})
export class MyCoreModule { }
  1. Inject the service NgPopupsService as a dependency of your component.
constructor(private ngPopups: NgPopupsService) {}
  1. Make sure you have BrowserAnimationsModule imported in your root module (e.g. app.module.ts).
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
...
@NgModule({
  declarations: [ ... ],
  imports: [
    ...,
    BrowserAnimationsModule,
    ...
  ],
  providers: [ ... ],
  bootstrap: [AppComponent]
})
  1. Use any of these three methods to create the dialogs: alert, confirm, prompt.
// Alert
this.ngPopups.alert('Whoa boy, be careful!');

// Confirm
this.ngPopups.confirm('Do you blindly accept our conditions?')
  .subscribe(res => {
    if (res) {
      console.log('You clicked OK. You dumb.');
    } else {
      console.log('You clicked Cancel. You smart.');
    }
  });

// Prompt. Callback param has the following form:
// { result: boolean, value: string }
this.ngPopups.prompt('Please type your email below.')
  .subscribe(res => {
    if (res.result) {
      console.log('Thanks, now we have your email:', res.value);
    }
  });

Advanced

Global configuration

You can globally configure all your dialogs for properties like titles, texts and colors. Do this by passing a config object in the forRoot module declaration (see step 1).

NgPopupsModule.forRoot(globalConfig: NgPopupsGlobalConfig)
NgPopupsGlobalConfig

Find below an example of a global config object. Please note that all these properties are optional. Please check out the SOURCE for full descriptions of all properties and its allowed and default values.

NgPopupsModule.forRoot({
  theme: 'material', // available themes: 'default' | 'material' | 'dark'
  okButtonText: 'Yes',
  cancelButtonText: 'No',
  color: '#8030c3',
  titles: {
    alert: 'Danger!',
    confirm: 'Confirmation',
    prompt: 'Website asks...'
  }
});

Local configuration

You can also pass a configuration object to the methods alert(), confirm() and prompt() as the second argument. Any property set here will obviously override the corresponding global configuration.

NgPopupsLocalConfig

The configuration example below applies for any of the three main methods. Please check out the SOURCE for full descriptions of all properties and its allowed and default values.

this.ngPopups.confirm('Do you agree to follow Barça?', {
  theme: 'dark',
  okButtonText: 'Yes, I do',
  cancelButtonText: 'Nope',
  color: 'red',
  title: 'Wait, think twice'
});

Note: When using prompt, you can also set the defaultText property which will be used to autofill the text input.

Contributing

Feel free to open issues, shoot PRs, reach out on twitter, etc.

This is really just a good ol' Angular CLI project. Feel free to clone the project and play around if you feel like adding new features or fixing bugs.

Run the demo via npm start. All the library code lies inside projects/ng-popups.

Licence

MIT © Carlos Roso


Shameless self promotion: This library was created using ng-lib-schematics, which is a Schematic I built to create Angular libraries.

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].