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 🙏

© 2024 – Pkg Stats / Ryan Hefner

window-modal-dialog

v0.0.5

Published

`window-modal-dialog` Modal popup for Angular 14+ pure css bootstrap modal. Easy to integrate & easy to use. Looks similar like bootstrap modal but different is to maintain the code redability by making different components for modal popups.

Downloads

24

Readme

All Contributors npm npm npm License Support

What is use?

window-modal-dialog Modal popup for Angular 14+ pure css bootstrap modal. Easy to integrate & easy to use. Looks similar like bootstrap modal but different is to maintain the code redability by making different components for modal popups.

Installation

npm install --save window-modal-dialog

Features

  • Seperated with many components
  • Increase code readability
  • Parent to child modal communication
  • Customization with css
  • Pure css responsive
  • Default header
  • Light weight library

Usage

From your Angular AppModule:

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { AppComponent } from "./app.component";
import { WindowModalDialogModule } from "window-modal-dialog";

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    WindowModalDialogModule.forRoot(), // <============ Don't forget to call 'forRoot()'!
  ],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}

In your app.component.html, simply add modal open button:

<div style="padding: 20%; display: flex; justify-content: center;">
  <button style="width: 200px; height: 40px; background: gray;" (click)="open()">Open Modal Popup</button>
</div>

In your app.component.ts

import { Component } from "@angular/core";
import { WindowModalDialogService } from "window-modal-dialog";
import { SampleModalComponent } from "./modal.component";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
})
export class AppComponent {
  constructor(private modal: WindowModalDialogService) {}

  open() {
    const x = this.modal.open(SampleModalComponent, {
      title: "Open Dialog Modal",
      disableClose: true,
      data: {
        name: "Bhushan",
        lname: "Zade",
      },
    });
    x.afterClose?.subscribe((res) => {
      console.log(res);
    });
  }
}

Sample Custom Modal Component & HTML

import { Component, Inject, Optional } from '@angular/core';
import { WINDOW_DIALOG_DATA } from 'window-modal-dialog';

@Component({
  selector: 'app-sample-modal',
  template: `
    <div class="window-modal-body">
      <div>This is your custom modal content</div>
      <div>
          <pre> {{ data | json}}</pre>
      </div>
    </div>
    <div class="window-modal-footer">
      <button (click)="save()">Save</button>
    </div>
  `
})
export class SampleModalComponent {

  constructor(
    @Optional() @Inject(WINDOW_DIALOG_DATA) public data: any
  ) { }

  save(): void {
    this.modal.close("1st modal emmited value");
  }
}

Available Options

  • [defaultHeader]: To set default header or not. By default its true and need to pass title in default header.
  • [title]: To show title in modal popup. Default is Modal Title string format.
  • [disableClose]: If you want to prevent clicks outside of modal window then set disableClose as true else false to close modal by click outside. Default is false.
  • [data]: To pass dynamic data to the modal component. By Default its null data.
  • [width]: To set width of modal window. Default is 100%.
  • [minWidth]: To set minimum width of modal window. Default is 400px.
  • [height]: To set height of modal window. Default is 100%.
  • [minHeight]: To set minimum height of modal window. Default is 800px.
  • [afterClose]: To received value from closing modal component by subscribing afterClose observable.

Dependencies

  • Angular 14+ Support

Creator


Bhushan Zade