이게 원하는가요?
html 파일
<!-- Modal Structure -->
<a class="waves-effect waves-light btn modal-trigger" href="#modal1">Modal</a>
<div id="modal1" class="modal">
<div class="modal-content">
<!--following line has the icon to close the modal on your command-->
<h4>Modal Header <i class = "material-icons right" id = "closeIcon">close</i></h4>
<p>A bunch of text</p>
<!--following button adds text to the <p> tag with id = "textBody" i.e. its doing something and the modal wont close until that is done-->
<button class = "btn waves-effect waves-light" id = "doSomething">Press me and do something</button>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div>
<p id = "textBody">
</p>
JQuery와 여기
$(document).ready(function(){
$('.modal-trigger').leanModal({
dismissible: false,
/*waiting for the user to click the button before closing*/
complete: $('#doSomething').click(function(){
$('#textBody').html('i got a Boo Boo');
$('#modal1').closeModal();
})
});
$("#closeIcon").click(function(){
$('#modal1').closeModal();
});
})
무슨 일이 일어나고 있는지 확인하는 링크입니다 : https://jsfiddle.net/4y6ptm8k/4/
방법이 Angular2 관련이가? 실제로 더 많은 문맥을 추가하십시오. Angular2에서 어디에서 어떻게 사용하고 있습니까? –