Angular bootstrap模态打开onload

时间:2014-07-16 12:26:19

标签: jquery angularjs twitter-bootstrap

我正在使用http://angular-ui.github.io/bootstrap/模态。

现在我想在页面加载时打开模态

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

2 个答案:

答案 0 :(得分:2)

Angular http://angular-ui.github.io/bootstrap/有一个指令和$ modal服务,这两个服务都可以用来打开模态窗口。

然后你需要使用:

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

这里有一个类似的问题:Invoking modal window in AngularJS Bootstrap UI using JavaScript

答案 1 :(得分:1)

模块API具有run方法。在您的应用程序代码中,您添加代码以在运行回调中打开对话框

angular.module('myAppModule').run(function($modal) {
  $modal.open(options);   //the option data. See documentation.
});
相关问题