Home  >  Article  >  Web Front-end  >  How to get built-in services to obtain local information in Angular

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

一个新手
一个新手Original
2017-10-14 09:10:381470browse

We used angular 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 the hash part of URL

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 }}

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!

Statement:
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