@wobius/dialog
TypeScript icon, indicating that this package has built-in type declarations

6.0.2 • Public • Published

Easily add different types of dialogs to your Angular + Material project.

Import the Module:

import { DialogModule } from '@wobius/dialog'

@NgModule({
    imports: [ DialogModule ]
})

Usage:

import { Component } from '@angular/core'
import { MatDialog } from '@angular/material/dialog'
import { DialogComponent } from '@wobius/dialog'

@Component({
    template: `
        <button (click)="onUserInput()">User Input</button><br>
        <button (click)="onConfirm()">Confirmation</button>
    `
})
export class MyComponent {
    constructor(private dialog:MatDialog) {}
    onUserInput() {
        let d = this.dialog.open(DialogComponent)
        d.componentInstance.title = "Enter Name"
        d.componentInstance.content = "Input Hint"
        d.afterClosed().subscribe(res => {
            console.log(res)
        })
    }
    onConfirm() {
        let d = this.dialog.open(DialogComponent)
        d.componentInstance.isConfirmation = true
        d.componentInstance.title = "Confirmation"
        d.componentInstance.content = "Are you sure you want to proceed?"
        d.afterClosed().subscribe(res => {
            console.log(res)
        })
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @wobius/dialog

Weekly Downloads

0

Version

6.0.2

License

ISC

Unpacked Size

9.77 kB

Total Files

12

Last publish

Collaborators

  • jeram