Angular bootstrap modal open onload

2020-04-14 08:46发布

I am using http://angular-ui.github.io/bootstrap/ modal.

Now i want to open Modal whenever page loads

  <script>
     $(document).ready(function () {                
                 open('lg');         
      });
  </script>

2条回答
何必那么认真
2楼-- · 2020-04-14 08:57

Module API has a run method. In your code for you app you add code to open the dialog in the run callback

angular.module('myAppModule').run(function($modal) {
  $modal.open(options);   //the option data. See documentation.
});
查看更多
Animai°情兽
3楼-- · 2020-04-14 09:12

Angular http://angular-ui.github.io/bootstrap/ has a directive and the $modal service and both of those can be used to open modal windows.

you then need to use:

$modal.dialog({}).open('modalContent.html');  

there is a similar question in here: Invoking modal window in AngularJS Bootstrap UI using JavaScript

查看更多
登录 后发表回答