从javascript内部获取AngularJS对象以打开引导模式

从javascript内部获取AngularJS对象以打开引导模式,javascript,angularjs,twitter-bootstrap,modal-dialog,rootscope,Javascript,Angularjs,Twitter Bootstrap,Modal Dialog,Rootscope,logout()具有打开模型的代码。我只希望在rootscope中的angularjs对象值为true时调用logout()函数。。如何从javascript检查rootscope对象中的内容 <body ng-controller="myController"> <div id="myPopup" modal custom-model fade" style="left:20%" data-backdrop="static" data-keyb

logout()具有打开模型的代码。我只希望在rootscope中的angularjs对象值为true时调用logout()函数。。如何从javascript检查rootscope对象中的内容

<body ng-controller="myController">
    <div id="myPopup" modal custom-model fade" style="left:20%"
            data-backdrop="static" data-keyboard="false">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="custom-modal-header">
                    </div>
                    <div class="custom-modal-body">
                    </div>
                    <div class="custom-modal-footer">
                    </div>
                </div>
            </div>
        </div>  



<script type="text/javascript">
logout();//here add if rootscope.mydata == true 
</script>  
</body>


直接的答案是,将
$rootScope
注入控制器:

angular
    .module("yourAppName")
    .controller("myController", function ($rootScope) {
        // $rootScope is available here!
        if ($rootScope..mydata) {
            // show modal?
        }
    })
您没有指定要启动
注销
功能的内容、按钮单击或控制器加载时,请根据需要进行调整