A customizable modal for Angular 2
It uses the Bootstrap modal by default. You can also provide a custom modal view.
- Default bootstrap modal layout
- Customizable modal layout
- Alert dialog
- Customizable Alert component
- Confirmation dialog
- Customizable Confirmation component
- Dialog result callback
- Dialog dismiss callback
- Dismiss validation
- Good documentation
- Install the package
ng2-openmodal
npm install --save ng2-openmodal
- Add entries in the file
systemjs.config.js
...
var map = {
...
// Here it goes!
'ng2-openmodal': 'node_modules/ng2-openmodal',
...
};
var packages = {
...
'ng2-openmodal': { main: 'index.js', defaultExtension: 'js' },
...
};
- Set the modal placement, e.g.
import { ModalService } from 'ng2-openmodal';
...
@ViewChild('modalPlacement', {read: ViewContainerRef}) modalPlacement: ViewContainerRef;
...
this.modalService.setPlacement(this.modalPlacement);
- Invoke
ModalService.openModal
. TODO Improve documentation - Enjoy it!
- TODO documentation of
setModalLayout(type)
: - TODO documentation of
setAlertComponent(type)
: - TODO documentation of
setConfirmComponent(type)
: - TODO documentation of
setPlacement(container: ViewContainerRef)
: - TODO documentation of
openModal(componentType: any, title: string, contentParams?: any): ThenElse<any>