Invoking modal window in AngularJS Bootstrap UI using JavaScript

前端 未结 6 1290
别那么骄傲
别那么骄傲 2020-11-29 16:25

Using the example mentioned here, how can I invoke the modal window using JavaScript instead of clicking a button?

I am new to AngularJS and tried searching the docu

6条回答
  •  生来不讨喜
    2020-11-29 17:08

    Quick and Dirty Way!

    It's not a good way, but for me it seems the most simplest.

    Add an anchor tag which contains the modal data-target and data-toggle, have an id associated with it. (Can be added mostly anywhere in the html view)

    
    

    Now,

    Inside the angular controller, from where you want to trigger the modal just use

    angular.element('#myModalShower').trigger('click');
    

    This will mimic a click to the button based on the angular code and the modal will appear.

提交回复
热议问题