HTML स्रोत कोड का उपयोग करदोनों <em>परीक्षण</em> लौट ऊपर URL के लिए परिणाम के रूप में AngularJS
<div ng-app="">
<div ng-controller="test">
<div ng-address-bar browser="html5"></div>
<br><br>
$location.url() = {{$location.url()}}<br>
$location.search() = {{$location.search('keyword')}}<br>
$location.hash() = {{$location.hash()}}<br>
keyword valus is={{loc}} and ={{loc1}}
</div>
</div>
AngularJS स्रोत कोड
<script>
function test($scope, $location) {
$scope.$location = $location;
$scope.ur = $scope.$location.url('www.html.com/x.html?keyword=test#/x/u');
$scope.loc1 = $scope.$location.search().keyword ;
if($location.url().indexOf('keyword') > -1){
$scope.loc= $location.url().split('=')[1];
$scope.loc = $scope.loc.split("#")[0]
}
}
</script>
यहाँ चर loc
और loc1
url पैरामीटर प्राप्त करने के लिए कैसे। क्या यह सही तरीका है?
आप [$ रूट पैराम्स] (http://docs.angularjs.org/api/ng.$routeParams) को देखना चाह सकते हैं। –
यह स्पष्ट नहीं है कि आप यहां क्या पूछ रहे हैं ... $ रूट पैराम और $ स्थान # विधियों के दस्तावेज़ आपको – deck
शुरू करना चाहिए, कृपया मतदान करते समय टिप्पणी जोड़ने पर विचार करें ताकि प्रश्न में सुधार किया जा सके। धन्यवाद। – praveenpds