主要用到$window.onresize,监测窗口大小变化,当窗口大小发生变化时执行事件或某个函数


  myapp.controller('MainCtrl', function($scope,$http,$window){
           this.userName = 'EJT Admin';


$window.onresize=function(){
    var bwidth=$window.innerWidth;
 // console.log($window.innerWidth)
    if (bwidth <=770) {
      console.log(bwidth)
        $scope.hideserver=true;
      }
      else{
        $scope.hideserver=false;
    }
    $scope.$apply();
};
if ($window.innerWidth<=770) {
        $scope.hideserver=true;
  } else{
        $scope.hideserver=false;
    }

          $scope.toggleServer=function(){
           // $('.ejttable').css('width', '100%');
            $scope.hideserver=$scope.hideserver===false ? true:false;

          };

results matching ""

    No results matching ""