<html><script src="https://cdn.staticfile.net/angular.js/1.6.9/angular.min.js"></script><body><div ng-app="myApp" ng-controller="myCtrl"><p>本页的 URL 是:</p><h3>{{myUrl}}</h3></div><p>本示例使用内置的 $location 服务来获取页面的绝对URL。</p><script>var app = angular.module('myApp', []);app.controller('myCtrl', function($scope, $location) { $scope.myUrl = $location.absUrl(); // 将页面的绝对 UR L赋值给 myUrl 变量});</script></body></html>