# m-dialog-2

> Angular 2 modal component

Latest version **0.0.3** (published 2017-01-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install m-dialog-2
pnpm add m-dialog-2
yarn add m-dialog-2
bun add m-dialog-2
```

## 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.3 |
| Published | 2017-01-10 |
| First published | 2016-12-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+16 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | mahpah |
| Keywords | redactor |

## Links

- npm: https://www.npmjs.com/package/m-dialog-2
- npm.io page: https://npm.io/package/m-dialog-2

## Dependencies (4)

- [rxjs](https://npm.io/package/rxjs.md) ^5.0.0-beta.12
- [zone.js](https://npm.io/package/zone.js.md) ^0.6.26
- [@angular/core](https://npm.io/package/@angular/core.md) ^2.1.2
- [@angular/common](https://npm.io/package/@angular/common.md) ^2.1.2

## Recent versions

- 0.0.3 (latest) — 2017-01-10
- 0.0.2 — 2016-12-19

## README

# Angular2 modal component

For angular 1 one, please check this repo: https://github.com/mahpah/mDialog

## Manual

Import `MDialogModule` to your main module as root. Register your custom modal within your main module or any module.

```
@NgModule({
	imports: [
		// ...
		MDialogModule.forRoot(),
	],
	declarations: [
		MyCustomModal,
	],
	entryComponents: [
		MyCustomModal,
	],
})
export class MainModule {}
```

Call `MDialogService.create()` from your component

```
class AppComponent {

	constructor(
		private mDialog: MDialogService,
	) {}

	openModal() {
		let modalRef = this.mDialog.create(
			MainModule,
			MyCustomModal,
			// ...any data
		)
	}
}
```

`modalRef` contain 2 replay subject: `componentRef` emit event when component created; and `result` subject emit event when dialog close or dismiss

```
interface ModalRef {
	componentRef: ReplaySubject<componentInstance>,
	result: ReplaySubject<DialogResult>
}
```

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