#Angular2 Bootstrap Modal Service It is a library to make usage of bootstrap modal plugin easier in Angular2. Create clear and reusable modal components. It makes managing dialogs painless and more clear. Library does not use bootstrap js, only css. Compatible with bootstrap 3 and bootstrap 4. ##Installation ```npm npm install ng2-bootstrap-modal ``` See [Live Demo](https://plnkr.co/edit/MB6NnzfhicMyAiMJy6YM?p=preview) ###Without bootstrap? Yes, you can create your own css. Just write css for .modal and .modal-dialog classes. ```css .modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1050; overflow: hidden; -webkit-overflow-scrolling: touch; outline: 0; } .fade { opacity: 0; -webkit-transition: opacity .15s linear; -o-transition: opacity .15s linear; transition: opacity .15s linear; } .fade.in { opacity: 1; } .modal-dialog { position: relative; width: auto; margin: 10px; } .modal.in .modal-dialog { -webkit-transform: translate(0,0); -ms-transform: translate(0,0); -o-transform: translate(0,0); transform: translate(0,0); } .modal.fade .modal-dialog { -webkit-transition: -webkit-transform .3s ease-out; -o-transition: -o-transform .3s ease-out; transition: transform .3s ease-out; -webkit-transform: translate(0,-25%); -ms-transform: translate(0,-25%); -o-transform: translate(0,-25%); transform: translate(0,-25%); } @media (min-width: 768px) { .modal-dialog { width: 600px; margin: 30px auto; } } ``` ##Quickstart ### Step 1. add bootstrap css You can add bootstrap css from cdn ```html ``` or ```html ``` ### Step 1. import '**BootstrapModalModule**' module app.module.ts: ```typescript import { NgModule} from '@angular/core'; import { CommonModule } from "@angular/common"; import { BrowserModule } from '@angular/platform-browser'; import { BootstrapModalModule } from 'ng2-bootstrap-modal'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ CommonModule, BrowserModule, BootstrapModalModule ], bootstrap: [AppComponent] }) export class AppModule {} ``` By default dialogs placeholder will be added to AppComponent. But you can select custom placeholder (for example document body): ```typescript imports: [ ... BootstrapModalModule.forRoot({container:document.body}) ] ``` ###Step 2. Create your modal dialog component Your modal dialog is expected to be extended from **DialogComponent**. **DialogService** is generic class with two arguments: 1) input dialog data type (data to initialize component); 2) dialog result type; Therefore **DialogService** is supposed to be a constructor argument of **DialogComponent**. confirm.component.ts: ```typescript import { Component } from '@angular/core'; import { DialogComponent, DialogService } from "ng2-bootstrap-modal"; export interface ConfirmModel { title:string; message:string; } @Component({ selector: 'confirm', template: `