Angular bootstrap confirm
Demo
https://mattlewis92.github.io/angular2-bootstrap-confirm/
Table of contents
About
A simple angular2 directive to display a bootstrap styled confirmation popover when an element is clicked.
Pull requests are welcome.
AngularJS 1.x version
Installation
Install through npm:
npm install --save @angular/core@2.0.0-rc.1 angular2-bootstrap-confirm
Then use it in your app on a component:
import {Component, provide} from '@angular/core';
import {Confirm, ConfirmOptions, Position} from 'angular2-bootstrap-confirm';
import {PositionService} from 'angular2-bootstrap-confirm/position/position';
@Component({
selector: 'my-component',
providers: [
ConfirmOptions,
provide(Position, {
useClass: PositionService
})
],
directives: [
Confirm
],
template: `
<button
class="btn btn-default"
mwl-confirm
[title]="title"
[message]="message"
placement="left"
(confirm)="confirmClicked = true"
(cancel)="cancelClicked = true"
[(isOpen)]="isOpen">
Click me!
</button>
`
})
class MyComponent {
public title: string = 'Popover title';
public message: string = 'Popover description';
public confirmClicked: boolean = false;
public cancelClicked: boolean = false;
public isOpen: boolean = false;
}
You may also find it useful to view the demo source.
Usage without a module bundler
<script src="node_modules/angular2-bootstrap-confirm/position/position.js"></script>
<script src="node_modules/angular2-bootstrap-confirm/angular2-bootstrap-confirm.js"></script>
<script>
// position service available as ng2BootstrapPosition.PositionService
// confirm options, directive and position token available as ng2BootstrapConfirm.ConfirmOptions, ng2BootstrapConfirm.Confirm, ng2BootstrapConfirm.Position
</script>
Documentation
All documentation is auto-generated from the source via typedoc and can be viewed here:
https://mattlewis92.github.io/angular2-bootstrap-confirm/docs/
The main confirm directive options can be viewed here.
Development
Prepare your environment
- Install Node.js and NPM (should come with)
- Install local dev dependencies:
npm install
while current directory is this repo
Development server
Run npm start
to start a development server on port 8000 with auto reload + tests.
Testing
Run npm test
to run tests once or npm run test:watch
to continually run tests.
Release
- Bump the version in package.json (once the module hits 1.0 this will become automatic)
npm run release
License
MIT