How to get built-in services to obtain local information in Angular

一个新手
Release: 2017-10-14 09:10:38
Original
1530 people have browsed it

We usedangular to set a timer before. Today we will do some exercises based on the timer.

Use the built-in service to obtain the following information:

1. Get the screen height

2. Get the screen width

3.Get the pagetitle

4.GetURLProtocol

5.GetURLHost

6. Get the port number

7.Get thehashpart ofURL

8.Get the access address, that is,URLAddress

##Other requirements:

1. The height and width are displayed 2 seconds after opening the page

2.title, protocol, host will be displayed 3 seconds after opening the page

3. Port number, url address will be displayed 5 seconds after opening the page After that, a prompt box will pop up asking whether to display it. If you click yes, it will be displayed. Otherwise, it will not be displayed.

Source code:

##

   day12日考

屏幕有效的宽度(单位:像素):{{ width }}

屏幕有效的高度(单位:像素):{{ height }}

页面title:{{ title }}

URL主机:{{ host }}

URL协议:{{ protocol }}

端口:{{ port }}

URL的hash部分:{{ hash }}

URL地址:{{ href }}

Copy after login

The above is the detailed content of How to get built-in services to obtain local information in Angular. 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!