@wobius/dialog
v6.0.2
Published
Easily add different types of dialogs to your Angular + Material project.
Downloads
15
Readme
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)
})
}
}