आपकी ऑफलाइन सहायता

BACK
49

सी प्रोग्रामिंग

149

पाइथन प्रोग्रामिंग

49

सी प्लस प्लस

99

जावा प्रोग्रामिंग

149

जावास्क्रिप्ट

49

एंगुलर जे.एस.

69

पी.एच.पी.
माय एस.क्यू.एल.

99

एस.क्यू.एल.

Free

एच.टी.एम.एल.

99

सी.एस.एस.

149

आर प्रोग्रामिंग

39

जे.एस.पी.





डाउनलोड पी.डी.एफ. ई-बुक्स
AJS - Services $location

$location service; ये Object; window.location इस object जैसा होता है | ये object; location के बारे में सभी information को methods के माध्यम से प्राप्त करता है |


Example for $location Service in AngularJS

Source Code :
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
</head>
<body>

<div ng-app="app" ng-controller="ctrl">
$location.absUrl() :{{absUrl}}<br />
$location.hash() :{{hash}}<br />
$location.host() :{{host}}<br />
$location.path() :{{path}}<br />
$location.port :{{port}}<br />
$location.protocol() :{{protocol}}<br />
$location.search :{{search}}
</div>

<script>
var myapp = angular.module("app",[]); 
myapp.controller("ctrl", function($location,$scope){  
	$scope.absUrl = $location.absUrl();
	$scope.hash = $location.hash();
	$scope.host = $location.host();
	$scope.path = $location.path();
	$scope.port = $location.port();
	$scope.protocol = $location.protocol();
	$scope.search = $location.search();
});
</script>

</body>
</html>
Output :
$location.absUrl() :{{absUrl}}
$location.hash() :{{hash}}
$location.host() :{{host}}
$location.path() :{{path}}
$location.port :{{port}}
$location.protocol() :{{protocol}}
$location.search :{{search}}