zoukankan      html  css  js  c++  java
  • anaular js loadding效果

    以前用的jquery的时候,用ajax实现,比较好弄,下面是angularjs的方式:

    //body下面增加div
    <div data-loading></div>
    //directive实现
    planControls.directive('loading',  ['$http' ,function ($http) {
        return {
            restrict: 'A',
            replace:true,
            template: '<div class="loading-holder" style=" 100%;height: 100%;position: fixed;top: 0px; z-index: 1000000; background-color: black;opacity: 0.4;"  ><img style="position: fixed; top: 0px; left: 0px; right: 0px;bottom: 0px; margin: auto;" src="'
            +    DSJS.getWebRoot()+ '/resources/image/loadding.gif" /></div>',
            link: function (scope, elm, attrs)
            {
                scope.isLoading = function () {
                    return $http.pendingRequests.length > 0;
                };
    
                scope.$watch(scope.isLoading, function (v)
                {
                    if(v){
                        elm.show();
                    }else{
                        elm.hide();
                    }
                });
            }
        };
    }]);
    

      

  • 相关阅读:
    WebServices Get
    字符出现次数
    正则
    防止AutoPost
    转双问号,单问号
    GetData
    UpdatePanel
    字居中
    C# 面向对象之多态
    C# 委托之把委托从委托链(多播委托)移除
  • 原文地址:https://www.cnblogs.com/binlin1987/p/7516071.html
Copyright © 2011-2022 走看看