Thursday, 22 December 2016

How to use code to open a modal in Angular 2?




Usually we use data-target="#myModal" in the



Answer



This is one way I found. You can add a hidden button:






Then use the code to "click" the button to open the modal:




document.getElementById("openModalButton").click();


This way can keep the bootstrap style of the modal and the fade in animation.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...