# @darrenmothersele/simple-dialog

> A very simple dialog service, made using Angular's CDK.

Latest version **0.0.1** (published 2020-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @darrenmothersele/simple-dialog
pnpm add @darrenmothersele/simple-dialog
yarn add @darrenmothersele/simple-dialog
bun add @darrenmothersele/simple-dialog
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2020-01-28 |
| First published | 2020-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 59.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Darren Mothersele |
| Maintainers | darrenmothersele |

## Links

- npm: https://www.npmjs.com/package/@darrenmothersele/simple-dialog
- Repository: https://github.com/darrenmothersele/simple-dialog
- Homepage: https://github.com/darrenmothersele/simple-dialog#readme
- Issues: https://github.com/darrenmothersele/simple-dialog/issues
- npm.io page: https://npm.io/package/@darrenmothersele/simple-dialog

## Recent versions

- 0.0.1 (latest) — 2020-01-28

## README

# Simple Dialog

A very simple dialog service, made using Angular's CDK.

## Installation

    npm install --save ngx-simple-dialog

Then import the module in `app.module.ts`:

    imports: [
        ...
        SimpleDialogModule
    ]

Then use it in a component:

    import { SimpleDialogService } from 'simple-dialog';

In the template:

    <button type="button" (click)="openDialog()">Open Dialog</button>
    
In the component class:

      async openDialog() {
        const result = await this.dialog.open(ExampleDialogComponent, {
          data: {
            message: 'Hello world!'
          },
          closeOnBackdropClick: true
        });
        console.log({ result });
      }

You can pass arbitrary data into the dialog. Access this data by using 
constructor injection:

    import { Component, Inject } from '@angular/core';
    import { DIALOG_DATA, DialogRef } from 'simple-dialog';
    
    @Component({
      selector: 'app-load-form',
      template: `
          <div class="bg-white p-4 rounded shadow">
              <p class="mb-2">This is the load form dialog!</p>
              <div class="flex justify-end mt-4">
                  <button class="btn mr-2" type="button" (click)="dialog.close()">Cancel</button>
                  <button class="btn" type="button" (click)="dialog.close('ok')">OK</button>
              </div>
          </div>
      `
    })
    export class ExampleDialogComponent {
    
        constructor(
            public readonly dialog: DialogRef,
            @Inject(DIALOG_DATA) data: any
        ) {
        }
    }

---
_Source: https://npm.io/package/@darrenmothersele/simple-dialog · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
