AngularJS Getting Current URL
HTML
<script src="http://code.angularjs.org/1.0.0rc6/angular-1.0.0rc6.js"></script>
<!doctype html>
<html>
<body>
<div class="container"ng-app="MyApp" ng-controller="TestCtrl">
<div>
<p><a href="" ng-click="whereAmI(myUrl)">What's my URL?</a></p>
</div>
</div>
</body>
</html>
JavaScript
angular.module('MyApp', []).controller('TestCtrl', ['$scope', '$location',
function($scope, $location) {
// $scope.myUrl = $location.absUrl();
$scope.myUrl = $location.host();
console.log($scope.myUrl);
}
]);