I've got an angular 4 page including a ng-bootstrap modal. My code looks like this.
foo.html
[...]
<button class="btn btn-sm btn-secondary material-icons"
(click)="open(content)">search</button>
<ng-template #content let-c="close" let-d="dismiss">
content in here
</ng-template>
[...]
foo.ts
[...]
constructor(private modalService: NgbModal) { }
[...]
open(content) {
let options: NgbModalOptions = {
size: 'lg'
};
this.modalService.open(content, options);
}
[...]
Now when I click the button the modal opens. What I want to do now is open the model on ngChanges.
ngOnChanges(changes: any) {
open(content)
}
My problem is: How do I get the "content" here? Is there any way to get the ng-template programmatically? Thanks in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…