Created
May 31, 2019 11:00
-
-
Save zenius/4e71072b3f89f29f08412a41bdce2b42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In AngularJS, a service is a function, or object, that is available for, and limited to, your AngularJS application. | |
AngularJS has about 30 built-in services. One of them is the $location service. | |
The $location service has methods which return information about the location of the current web page: | |
var app = angular.module('myApp', []); | |
app.controller('customersCtrl', function($scope, $location) { | |
$scope.myUrl = $location.absUrl(); | |
}); | |
In order to use the service in the controller, it must be defined as a dependency. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment