Angularjs .scope()

Angularjs在有jquery的情况下可以用$().scope()取出某个dom元素的scope,没有的jquery也可用Angularjs自带的jqLite选取

使用示例:

var financialsBlockEle=document.getElementById('financialsBlock');
            $('#financialsBlock').scope().$watch( function(){
                    return financialsBlockEle.clientHeight;
                }, function(newvalue, oldvalue){
                    if(newvalue>30){
                        financialsBlockEle.style.cssText="padding:15px; border-bottom: 1px solid #eee;";
                    }
                }
            );
angular.element("#financialsBlock").scope()

官方地址:https://code.angularjs.org/1.3.20/docs/guide/scope

posted @ 2018-12-06 17:06  jim520  阅读(214)  评论(0编辑  收藏  举报