Socket
Socket
Sign inDemoInstall

ngx-bootstrap-confirm

Package Overview
Dependencies
6
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ngx-bootstrap-confirm

Bootstrap confirm provider for Angular 11+


Version published
Weekly downloads
23
decreased by-82.17%
Maintainers
1
Install size
119 kB
Created
Weekly downloads
 

Readme

Source

NgxBootstrapConfirm

Bootstrap confirm provider for Angular 11+

Demo

https://ngxconfirm.9lessons.info/

Installation

npm install --save ngx-bootstrap ngx-bootstrap-confirm

or if you use yarn:

yarn add ngx-bootstrap ngx-bootstrap-confirm

Usage

Import NgxBootstrapConfirmModule into your app's modules:

import { NgxBootstrapConfirmModule } from 'ngx-bootstrap-confirm';
 
@NgModule({
  imports: [
    NgxBootstrapConfirmModule
  ]
})

Import NgxBootstrapConfirmService into your app's components:

import { Component } from '@angular/core';
import { NgxBootstrapConfirmService } from 'ngx-bootstrap-confirm';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  constructor(private ngxBootstrapConfirmService: NgxBootstrapConfirmService){
  }

  action() {
    let options ={
      title: 'Sure you want to delete this comment?',
      confirmLabel: 'Okay',
      declineLabel: 'Cancel'
    }
    this.ngxBootstrapConfirmService.confirm(options).then((res: boolean) => {
      if (res) {
        console.log('Okay');
      } else {
        console.log('Cancel');
      }
    });
  }
}
}

#app.component.html

<button (click)="action()">Action</button>
<router-outlet></router-outlet>

Copy in styles.scss

.modal-dialog {
  width: 360px !important;
  margin-top: 120px;
  margin: 30px auto;
  .modal-content {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  }
  .confirm {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    min-height: 150px;
    .content {
      padding: 20px;
      border-radius: 10px;
      background-color: #fff !important;
      font-weight: 700;
    }
    .buttons {
      padding: 10px 15px;
      float: right;
      button {
        margin-right: 10px;
      }
    }
  }
}

License

The MIT License (MIT)

srinivas@9lessons.info

Keywords

FAQs

Last updated on 31 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc