Angular $location获取端口号

<!DOCTYPE html>
<html ng-app="myApp">
<head lang="en">
<meta charset="UTF-8">
<script src="js/angular.js"></script>
<title></title>
</head>
<body>
<div ng-controller="myCtrl">
<p>{{nowPort}}</p>
<button ng-click="handleClick()">
得到端口号
</button>
</div>
<script>
var app = angular.module('myApp', ['ng']);
app.controller('myCtrl', function ($scope,$location) {
$scope.nowPort = "";
$scope.handleClick = function () {
//获取端口号
$scope.nowPort = $location.port();
} })
</script>
</body>
</html>
上一篇:html5 +css3 点击后水波纹扩散效果 兼容移动端


下一篇:酷!使用 jQuery & Canvas 制作相机快门效果