Detailed interpretation of the concept of $window window object in AngularJS

亚连
Release: 2018-06-11 16:26:38
Original
1761 people have browsed it

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; } }());
Copy after login

$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

    AngularJS之$window窗口对象   

Copy after login

3. Implementation results

PS: Writing window.resize function in angularjs

    Title   

{{default}}

Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!