var app = angular.module('MyApp', []);
app.controller('testC',function($scope,$location){
$scope.getUrl = function(el){
alert($location.absUrl());
}
});
<div ng-app="MyApp">
<div ng-controller="testC">
<button ng-click="getUrl()">获取地址</button>
</div>
</div>