我有一个 Angular 4 页面,包括一个 ng-bootstrap 模式。我的代码看起来像这样。
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>
[...]
脚.ts
[...]
constructor(private modalService: NgbModal) { }
[...]
open(content) {
let options: NgbModalOptions = {
size: 'lg'
};
this.modalService.open(content, options);
}
[...]
现在,当我单击按钮时,模式会打开。我现在要做的是在 ngChanges 上打开模型。
ngOnChanges(changes: any) {
open(content)
}
我的问题是:我如何在这里获得“内容”?有没有办法以编程方式获取 ng-template?提前致谢!