0
我有一个组件,它包含一个模态。从其他组件打开模态组件
<div bsModal #lgModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title pull-left">Large modal</h4>
<button type="button" class="close pull-right" (click)="lgModal.hide()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
{{current}}
</div>
</div>
</div>
</div>
我开模与@ViewChild('lgModal') modal;
,并呼吁this.modal.show();
,但我想HTML代码中分离,所以是有可能从组件A
调用组件B
?
https://stackoverflow.com/questions/37888361/ng2-bootstrap-call-modal-defined-in-child-component-from-parent-compent – yurzui
可能重复[ng2-bootstrap显示/隐藏模式作为子组件](https://stackoverflow.com/questions/42735858/ng2-bootstrap-show-hide-modal-as-child-component) – Aravind