Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy AngularJS Tutorials</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"> </script> </head> <body> <div ng-app="myApp" ng-controller="locCtrl"> <h3 >My absurl : {{myabsurl}} </h3> <h3 >My URL : {{myurl}} </h3> <h3 >My Protocol : {{myprotocol}} </h3> <h3 >My HOST : {{myhost}} </h3> <h3 >My PORT : {{myport}} </h3> <h3 >My Path : {{mypath}} </h3> <h3 >My Search : {{mysearch}} </h3> <h3 >My Hash : {{myhash}} </h3> </div> <script> var app = angular.module("myApp", []); app.controller("locCtrl", function($scope, $location) { $scope.myabsurl = $location.absUrl(); $scope.myurl = $location.url(); $scope.myprotocol = $location.protocol(); $scope.myhost = $location.host(); $scope.myport = $location.port(); $location.path('wiki'); $scope.mypath = $location.path(); $scope.mysearch = $location.search(); $location.hash('techy'); $scope.myhash = $location.hash(); }); </script> </body> </html>
www.wikitechy.com © Copyright 2016. All Rights Reserved.