AngularJS Four Service

Source: Internet
Author: User

Angularjs Service:

Api:https://docs.angularjs.org/api/ng/service below will only introduce a few, if necessary, can go to the official website to view

ANGULARJS services are JavaScript functions for specific tasks that can be reused throughout the application.

Note:Angularjs built-in services start with $ and are the same as other built-in objects.

all the angular services are Lazy Instantiation and the Single Case . This means that the ANGULARJS framework instantiates a service when the application component relies on it . Also, all components share the same service instance .

$ HTTP Service:

$http. Get instance:

Get pass Parameter

post-pass parameter

If you press jquery mode, the pass-through parameter is not available in the background.

We need to make some changes in Angularjs.

Use $http to complete a GET or post submission

$log

ANGULARJS contains the logging service $ log, which logs messages to the browser's console.

$interval

Angularjs includes the $ interval service, which performs the same tasks as the SetInterval () method in JavaScript. $ interval is a wrapper for the SetInterval () method, so it is easy to overwrite.

$ window

Angularjs contains the window service, which points to the browser Windows object.

In JavaScript, window is a global object that contains many built-in methods, such as alert (), prompt (), and so on.

AngularJS Four Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.