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