Home
Tutorials
Microsoft Technologies Tutorials
Java Programming Tutorials
Web Designing Tutorials
Script Programming Tutorials
Database Programming Tutorials
Mobile Technologies Tutorials
Other Programming Tutorials
Examples
Articles
Tools
News
AngularJS Location Service Example
Keywords : Angularjs $location example, Angularjs window.location example, Angularjs $location.path() example, Angularjs $location.port() example, Angularjs $location.host() example
Example
<!DOCTYPE html> <html> <head> <title> AngularJs $location Service with Example </title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script type="text/javascript"> var app = angular.module('locationApp', []); app.controller('locationCtrl', function ($scope, $location) { $scope.weburl = $location.absUrl(); $scope.urlhost = $location.host(); $scope.urlport = $location.port(); $scope.urlprotocol = $location.protocol(); }); </script> </head> <body> <h2>AngularJS Location Service Example</h2> <div ng-app="locationApp" ng-controller="locationCtrl"> <p>Url of Webpage: {{weburl}}</p> <p>Host of Webpage: {{urlhost}}</p> <p>Port of Webpage: {{urlport}}</p> <p>Protocol of Webpage: {{urlprotocol}}</p> </div> </body> </html>
Click Here to See Result
Result
Previous
Next