angularjs-$location 服务
2017-02-06 15:26
211 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<p>当前页面的url:</p>
<h3>`myUrl`</h3>
</div>
</body>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module("myApp",[]);
app.controller("myCtrl",function($scope,$location){
$scope.myUrl = $location.absUrl();
});
</script>
</html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<p>当前页面的url:</p>
<h3>`myUrl`</h3>
</div>
</body>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module("myApp",[]);
app.controller("myCtrl",function($scope,$location){
$scope.myUrl = $location.absUrl();
});
</script>
</html>
相关文章推荐
- AngularJS常用服务($http、$location、$sce等)
- AngularJs服务-$location(暴露当前地址栏的URL)
- AngularJS常用服务($http、$location、$sce等)
- angularjs的 $location 服务
- AngularJs 服务之$location
- AngularJs的内置服务$window,$document,$location
- Angularjs自定义服务~使用Module的provider方法
- $q -- AngularJS中的服务
- 【AngularJS: Up & Running】第05章_AngularJS服务揭秘
- angularJS 自定义工厂和服务实现共享数据
- angularJs的那些坑——$http服务
- angularJS 服务(service)
- AngularJs基础——常用服务
- AngularJS系列(四)——服务
- Angularjs 服务注册
- angularjs--服务
- AngularJs中的服务
- AngularJS内的服务
- AngularJs 服务之$log
- AngularJs 的服务