Hi Guest 1 HomePage 1 Jobs 1 WalkIn 1Articles  

 :) Latest Topic
Numbers And Strings
Objects And Array
AngularJS VS JavaScript
Controllers in Files
Load the Library
AngularJS Directives
Repeating Directive
AngularJS Facts
Create Directives
Restrict Directive
Custom Filter
AngularJS Services
AngularJS Service 2
AngularJS Tables
Select Option
Select Option 2
AngularJS Forms
Form Validation
Validation CSS
Validation Example
AngularJS API
AngularJS $http
AngularJS Database
AngularJS HTML DOM
AngularJS Events
Custom Validation
AngularJS Tutorial
AngularJS Introduction
Angular init Directive
AngularJS Expressions 1
AngularJS Applications
AngularJS Expressions 2
Angular CSS Properties
AngularJS JSON
AngularJS Modules
Controller Basic
Add a Directive
Model Directive
Validate Inputs
CSS Classes
Data Binding
AngularJS Controller
AngularJS Scope
Root of Scope
AngularJS Filters
 


  

 
AngularJS Services
Question Posted on 18 Apr 2020

Home >> Tutorial >> AngularJS >> AngularJS Services


AngularJS Services
In AngularJS we can make our own service or we can use one of many built-in services. In AngularJS a service is a function, Object, that is available for limited to our our AngularJS application. AngularJS has 30 built-in services. One of them is $location service. This $location service has methods which will return information about the location of current web page.

AngularJS location
One important aspect here is that we have passed $location service to the controller as an argument. And order to consume service in the controller we must defined that as a dependency.

Why use Services?
There is one object called window.location that is allready there in DOM but we will use $location in place of window.location. And reason is that it would have some limitations at least for our AngularJS application. As we knows that AngularJS constantly will supervises our application to handle changes and events properly. And AngularJS prefers that use $location service instead of window.location object.

$http Service
If we are saying about AngularJS then we cannot forgot to discuss about the $http service. Because it is one of the most common used services in AngularJS applications. From this service we can makes a request to the server and response is to be handle by the application. Below example will provide some information on this:-


AngularJS Webservice





Other Important Questions
Numbers And Strings
Objects And Array
AngularJS VS JavaScript
Controllers in Files
Load the Library







 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |