私はangular2 + ng-bootstrap + bootstrap Beta 4で私の最初のプロジェクトを開始しています。Angular2 ng-bootstrap:同じモーダルウィンドウ用に2つの異なるボタンが必要
私の問題はこれです: 2つの異なるボタン(別のhtmlテンプレートにあります)から同じモーダルウィンドウを開きたいとします。私が見つけた唯一の解決策は、ボタンを含む私のHTMLテンプレートを複製することです。私はもっと良い解決策があると確信しています。
<ng-template #contact let-c="close" let-d="dismiss">
<div class="modal-header">
<h4 class="modal-title">Modal1</h4>
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>I'd like my 2 differents buttons to open the same modal window</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-dark" (click)="c('Close click')">Close</button>
</div>
</ng-template>
<button class="btn btn-lg btn-outline-primary" (click)="open(contact)">Contact button but with different text and style and same popup</button>
http://plnkr.co/edit/pmRdVLyDLkJkkIPLItAL?p=preview
あなたの助けに感謝し、あなたが主成分にごcontact
マークアップを移動することができます
プランナーファイルが表示されません。また、あなたのコードをあなたの質問にテキストとして含めることをお勧めします。 –
私は自分の投稿を編集しました。アドバイスありがとう –