Angular 2+ Component For Bootstrap Modal

Author: cipchk
Publish Date:
Official Page: Go to website
Views Total: 61
License: MIT

Description:

An Angular 2+ component to create and manage Bootstrap 3/4 based modal windows.

Installation:

npm install ngx-bootstrap-modal –save

Usage:

import { Component } from '@angular/core';
import { ConfirmComponent } from './confirm.component';
import { DialogService } from "ngx-bootstrap-modal";

@Component({
    selector: 'app',
    template: `
    <div class="container">
        <button class="btn btn-default" (click)="dialogService.alert('Confirm', 'Are You Sure');">Show confirm</button>
        <button class="btn btn-default" (click)="showConfirm()">Show confirm</button>
    </div>
    `
})
export class AppComponent {
    constructor(public dialogService:DialogService) {}
    showConfirm() {
        this.dialogService.confirm('Confirm', 'Are You Sure', <BuiltInOptions>{
        }).then((result: boolean) => {
            // result
        });
    }
}

Preview:

Angular 2+ Component For Bootstrap Modal

Tags: