Socket
Socket
Sign inDemoInstall

@crystalui/angular-modal

Package Overview
Dependencies
5
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @crystalui/angular-modal

This module allows for show modal and dialog boxes.


Version published
Weekly downloads
8
increased by300%
Maintainers
1
Install size
350 kB
Created
Weekly downloads
 

Readme

Source

Modal for Angular 2

This module allows for show modal and dialog boxes.

Demo

http://crystalui.org/components/modal

Installation

Install the npm package.

npm i @crystalui/angular-modal

Import module:

import {ModalModule} from '@crystalui/angular-modal';

@NgModule({
    imports: [ModalModule]
})

Usage

To open the window, import the Modal service and call the load() method. As a parameter, pass your component. It will be the contents of the window.

import {Modal} from '@crystalui/angular-modal';
import {MyComponent} from './my.component';

public constructor(private modal: Modal) {};

showModal() {
    this.modal.load({
        id: 'my-modal', 
        component: MyComponent
    });
}

Properties

id: string = undefined
// The identifier of the window. It will distinguish one window from another.

mode: "desktop" | "mobile" | "dialog" = "desktop"
// The type of the window template.

data: any
// Any data that needs to be pass to the window. In the window component, you can get them using `@Input() modalData: any`. 

width: string = "800px"
// Width of the window.

height: string = "auto"
// Height of the window. By default, the height of the window is determined by the height of its content.

maxWidth: string = "calc(100% - 32px)"
// Maximum width of the window.

maxHeight: string = "calc(100% - 32px)"
// Maximum height of the window.

overlayBackdrop: boolean = true
// Whether the window has a backdrop.

backdropClass: string | { [key: string]: any; }
// Custom classes for the backdrop. Supports the same syntax as ngClass.

modalClass: string | { [key: string]: any; }
// Custom classes for the modal window. Supports the same syntax as ngClass.

Methods

namedescription
load({ id: "my-modal", component: MyComponent })Shows the modal.
close({ id: "my-modal" })Hides the modal.

Events

Window state changes are available by subscription stateEvents.subscribe().

namedescription
showThe event is called before the modal appears.
shownThe event is called after the animation of the appearance of the modal.
hideThe event is called before the modal is hidden.
hiddenThe event is called after the animation of the modal is hidden.

Keywords

FAQs

Last updated on 09 Aug 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc