2017-03-28 14 views
0

が、私はmodal componentを使用しています:モーダル-体で角度2:モーダル私の角2アプリケーションで開いたイベント

<div bsModal #addRecordModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" 
aria-hidden="true"> 
<div class="modal-dialog "> 
    <div class="modal-header"> 
    </div> 
    <div class="modal-body" style="min-height: 270px;"> 
     <app-my-test [modal]="addRecordModal"></app-edit-record> 
    </div> 
    ... 

を、ModalDirectiveが含まれていMyTestComponentが、そこにある:

@Component({...}) 
export class MyTestComponent implements OnInit, OnDestroy { 
    @Input() modal: ModalDirective; 
    ... 

どういうわけか、は、MyTestComponent内のモーダルオープンイベントを検出できますか?

答えて

0

あなたはどのよう$を宣言することができ、その後、あなたがshown.bs.modal機能では、ここでhttps://www.w3schools.com/bootstrap/bootstrap_ref_js_modal.asp 言及したすべてのこれらのイベントにアクセスする必要があります、あなたが使用して子コンポーネントに渡されますその真としてthis.modalShown設定することができます@入力。あなたはngonchanges.Hopeを使用してこれを使用して子コンポーネントでこの入力の変更を聞くことができます。

関連する問題