angularjs中书写window.resize功能

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="angular.js"></script>
  <script>
    var app = angular.module('myApp', []);
    app.controller('myCtrl', function ($scope, $window) {
      $scope.default = "hello world";
      var w = angular.element($window);
      w.bind('resize', function(){
        console.log(new Date())
      })
    });
  </script>
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<h1>{{default}}</h1>
</div>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/chi1130/article/details/78801768