GithubHelp home page GithubHelp logo

juraji / ng-bootstrap-modals Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 2.6 MB

An alternative for ng-bootstraps's modals service.

License: MIT License

JavaScript 3.53% TypeScript 73.53% HTML 22.48% SCSS 0.42% CSS 0.03%

ng-bootstrap-modals's Introduction

GitHub release Library build badge Demo app build badge

NG Bootstrap Modals

What is it for

Basically a replacement for NG Bootstrap's modals implementation.

For a demo's and examples visit the demo site.

Why?

NG Bootstrap does a great job of abstracting Bootstrap's controls and widgets.

The only thing I do not agree on is their implementation of the modals:

  1. Direct access to the modal component's instance to inject data (inputs).
  2. No clear separation in api of how a modal was completed (dismiss or resolved)
  3. The use of entry components
  4. Modal components use DI injector of the module where they were spawned.

This library tries to fix these issues by merging NG Bootstrap's implementation with the one from Angular Material.

  1. It uses (encapsulated) DI injector to pass settings and data to the hosted modals
  2. The ModalRef now has the following outputs:
    • onResolve: Observable<T> emits and complets when the modal resolves with a value.
    • onDismiss: Observable<void> emits and completes when the modal is dismissed by the user pressing escape, clicking the close button or outside the container.
    • onComplete: Observable<void> emits and completes on resolved and dismissed.
  3. You no longer need to export your modal component as entry component. The way of constructing components is completely different.
  4. Injection is now inherited from the module which exports the component.

Installation instructions

Preconditions

Peer dependencies:

  • @angular/common: ^11.2.1
  • @angular/core: ^11.2.1
  • @angular/animations: ^11.2.1
  • bootstrap: ~4.5.0

Github packages

You will need to authorize to Github packages for the @juraji scope. If you have never done this before, read up on Configuring npm for use with GitHub Packages.

Just for reference, here's what my .npmrc looks like:

@juraji:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=MY_PERSONAL_ACCESS_TOKEN

The above configuration is the same for NPM and Yarn. It will route NPM and yarn to only use Github packages for the @juraji scope.

For more information on Github personal access tokens check your developer settings.

Installation

  1. Install @juraji/ng-bootstrap-modals.
    • For Yarn use yarn add @juraji/ng-bootstrap-modals.
    • For NPM use npm install @juraji/ng-bootstrap-modals.
  2. Add ModalModule.forRoot() to your root module.
  3. Use the Modals service to open components as modals.

For examples visit the demo site!

ng-bootstrap-modals's People

Contributors

juraji avatar rkesselerconvect avatar

Watchers

 avatar  avatar

ng-bootstrap-modals's Issues

Update user documentation

README.md

  • Explain goal of library
  • Install instructions (GH Packages, NPM, Yarn)
  • Basic usage information (Examples)
  • Api description (interface)
  • Add roadmap
  • List known bugs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.