This article mainly introduces the $window window object of AngularJS. Now I share it with you and give it as a reference.
A reference to a browser window object. It is a global object and is globally available in the window, but it causes some problems. It is also often referred to in Angular via the $window service, so it can be overridden, removed, and tested.
Verification code:
$window 等同于 window。 (function(){ angular.module('Demo', []) .controller('testCtrl',["$window",testCtrl]); function testCtrl($window) { $window === window; } }());
$window object can be used to obtain various properties of the browser window (such as window height and width, browser version, etc.).
1. Problem background
Print the contents of the input box through the $window object
2. Implementation source code
3. Implementation results
PS: Writing window.resize function in angularjs
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
3 basic modes of vue routing parameters (detailed tutorial)
Package and file in webpack Load to the specified location (detailed tutorial)
Make a breadcrumb navigation bar through elementUI in vue2.0
Put js in webpack Packaged map file (detailed tutorial)
The problem of obtaining the upload size of path compressed image in Webpack (detailed tutorial)
In vue Practical projects in iview less echarts (detailed tutorial)
The above is the detailed content of Detailed interpretation of the concept of $window window object in AngularJS. For more information, please follow other related articles on the PHP Chinese website!