1 Star 1 Fork 1

LeeYa Master / angular学习笔记

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
菜鸟教程实例25URL服务.html 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
LeeYa Master 提交于 2021-03-25 17:05 . first commit
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<p> 当前页面的url:</p>
<h3>{{myUrl}}</h3>
</div>
<p>该实例使用了内建的 $location 服务获取当前页面的 URL。</p>
<!--
window.locationcation $location.service
目的 允许对当前浏览器位置进行读写操作 允许对当前浏览器位置进行读写操作
API 暴露一个能被读写的对象 暴露jquery风格的读写器
是否在AngularJS应用生命周期中和应用整合 否 可获取到应用生命周期内的每一个阶段,并且和$watch整合
是否和HTML5 API的无缝整合 否 是(对低级浏览器优雅降级)
和应用的上下文是否相关 否,window.location.path返回"/docroot/actual/path" 是,$location.path()返回"/actual/path"
-->
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $location) {
$scope.myUrl = $location.absUrl();
});
</script>
</body>
</html>
JavaScript
1
https://gitee.com/leeyamaster/angular-learning-notes.git
git@gitee.com:leeyamaster/angular-learning-notes.git
leeyamaster
angular-learning-notes
angular学习笔记
master

搜索帮助