That\'s the way I use the ng2-bootstrap modal:
import {Component} from \'@angular/core\';
import {NgbModal} from \'@ng-bootstrap/ng-bootstrap\';
@Component({
Here's how you can pass data to your HTML Template in Angular2
import {Component} from '@angular/core';
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'add-customer-modal',
template: `
Modal title
{{MESSAGE_DATA}}
`})
export class AddCustomerModal {
MESSAGE_DATA : any;
constructor(private modalService: NgbModal) {}
open(content) {
this.MESSAGE_DATA = "PASS DATA TO ANGULAR2 MODAL"
this.modalService.open(content, { size: 'lg' }).result.then((result) => {
console.log(result);
}, (reason) => {
console.log(reason);
});
}
}
check how MESSAGE_DATA is used inside HTML Template.