Get started with ng2-bootstrap CDN
MIT licensed
Ng2-Bootstrap is a Angular 2+ library that provides Bootstrap 4 components and directives.
Tags:- angular2
- bootstrap
- angularjs
- twitter-bootstrap
Stable version
Copied!
How to start using ng2-bootstrap CDN
import { Component } from '@angular/core';
import { ModalDirective } from 'ng2-bootstrap';
@Component({
selector: 'app-root',
template: `
<button (click)="openModal()" class="btn btn-primary">Open Modal</button>
<ng-template #modalContent let-c="close">
<div class="modal-header">
<h4 class="modal-title">Modal Header</h4>
<button type="button" class="close" (click)="c.dismiss('Cross click')">×</button>
</div>
<div class="modal-body">
<p>Hello from a modal!</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="c.close('Close click')">Close</button>
</div>
</ng-template>
<ng-container *ngIf="!modalRef">
<ng-template #content>
<p>Click the button to open the modal.</p>
</ng-template>
<ng-container *ngIf="!modalRef">
<ng-bootstrap #bsModalContext="bsModalContext">
<ng-template #bsViewContainerRef="viewContainerRef">
<ng-template #modal>
<ng-container *ngIf="!modalRef">
<modal-content #modalContent [show]="false" class="modal-dialog modal-lg" backdrop="static" [container]="bsViewContainerRef">
<button type="button" class="close" (click)="modalRef.hide()">×</button>
<ng-content #modalContent></ng-content>
</modal-content>
</ng-container>
</ng-template>
</ng-template>
</ng-bootstrap>
</ng-container>
</ng-container>
`
})
export class AppComponent {
modalRef: ModalDirective;
openModal() {
this.modalRef = this.bsModalContext.show(this.modalContent, { class: 'modal-lg' });
}
}
All versions
1.0.1-beta.2
1.0.10
1.0.11
1.0.12
1.0.13
1.0.14
1.0.15
1.0.16
1.0.17
1.0.18
1.0.19
1.0.2-beta.0
1.0.2-beta.1
1.0.2-beta.2
1.0.20
1.0.21
1.0.22
1.0.23
1.0.24
1.0.3
1.0.4
1.0.5
1.0.6
1.0.7
1.0.8
1.0.9
1.1.0
1.1.1
1.1.10
1.1.11
1.1.12
1.1.13
1.1.13-0
1.1.13-1
1.1.14
1.1.14-0
1.1.14-1
1.1.15
1.1.16
1.1.16-10
1.1.16-11
1.1.16-3
1.1.16-4
1.1.16-6
1.1.16-7
1.1.16-8
1.1.16-9
1.1.17
1.1.2
1.1.3
1.1.4
1.1.5
1.1.6
1.1.7
1.1.8
1.1.9
1.2.0
1.2.1
1.2.2
1.2.3
1.2.4
1.2.5
1.2.6
1.3.0
1.3.1
1.3.2
1.3.3
1.4.0
1.4.0-beta.0
1.4.0-beta.1
1.4.0-beta.2
1.4.0-beta.3
1.4.0-beta.4
1.4.0-beta.5
1.4.0-beta.6
1.4.1
1.4.2
1.5.0
1.6.0
1.6.1
1.6.2
*** 1.6.3
2.0.0-beta.0
2.0.0-rc.0