TWBS Ratchet - How to close modal manually?

最后都变了- 提交于 2020-01-05 10:38:47

问题


I'm building a mobile web app with Ratchet. What I have to do is open a modal, fill a form, press a button then save and close the modal.

I'm able to close a modal with it's documented button, and I'm also able to save the form field...but how to do those things together? In Ratchet's documentation it's not explained how to close a modal manually using JavaScript.

I'm using Ratchet with AngularJS, so the button calls an Angular function in which I should close the modal.


回答1:


Ok, finally I solved this way.
In my modal I've added this button

<button class="btn" ng-click="add();" href="#myModal">Save</button>

By pressing this button I wanted to close the modal after some logic. So, this is my logic:

$scope.add = function() {
  // My logic here
  jQuery('#myModal').removeClass('active');
};

I hope this can help someone else...



来源:https://stackoverflow.com/questions/22606942/twbs-ratchet-how-to-close-modal-manually

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!