Angular 服务
来源:互联网 发布:逆战弹道优化 编辑:程序博客网 时间:2024/05/17 15:22
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body ng-app="MyApp" ng-controller="MyCont">
<input type="button" value="请求服务" ng-click="sev()" />
<input type="button" value="设置超时" ng-click="out()" />
<input type="button" ng-model="spa" />
<script>
var mo = angular.module("MyApp", []);
mo.controller("MyCont", function($scope, $http,$timeout,$interval) {
var aa=0;
$scope.sev = function() {
$http.get("http://www.baidu.com").then(function(response) {
alert(response.data.name)
}, function() {
alert("访问失败")
})
}
$scope.out=function(){
$timeout(function(){
alert("倒计时结束")
},3000)
}
$interval(function(){
alert("123");
},1000)
})
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title ng-model="tit">呵呵</title>
<script type="text/javascript" src="js/angular.min.js" ></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js" ></script>
</head>
<body ng-app="MyApp" ng-controller="MyCont">
<p ng-model="p1">{{p1}}</p>
<p ng-model="p2">{{p2}}</p>
<p ng-model="p3">{{p3}}</p>
<p ng-model="p4">{{p4}}</p>
<p ng-model="p5">{{p5}}</p>
<p ng-model="p6">{{p6}}</p>
<p ng-model="p7">{{p7}}</p>
<p ng-model="p8">{{p8}}</p>
<script>
var mo = angular.module("MyApp",[]);
mo.controller("MyCont",function($scope,$location,$window){
$scope.p8="URL地址是:"+$location.absUrl()
$scope.p1="屏幕高度是:"+$window.innerHeight;
$scope.p2="屏幕宽度是:"+$window.innerWidth;
$scope.p3="页面Title是:"+$scope.tit;
$scope.p4="URL协议是:"+$location.protocol();
$scope.p5="URL主机是:"+$location.host();
$scope.p6="端口号是:"+$location.port();
$location.path("aaa");
$scope.p7="设置URL的hash部分:"+$location.path();
})
</script>
</body>
</html>
- angular服务
- angular-服务
- Angular服务
- angular 服务
- angular服务
- Angular服务
- angular 服务
- Angular服务
- Angular 服务
- 【Angular】服务(Service)
- angular自定义服务
- angular的$interpolate服务
- angular $location服务
- angular的provider服务
- angular自定义服务
- Angular(二)服务
- Angular之$resource服务
- angular 自定义服务
- Tourism Planning (状态dp)
- C++11 for循环新用法、for_each 用法
- 接华为应用
- Linux MySQL-5.7安装(1)
- 写论文,为什么要写参考文献?感觉完全不必要,把自己的研究成果说清楚不就行了?
- Angular 服务
- 使用CXF+spring+restful创建一个web的接口项目
- openVswitch(OVS)源代码分析之工作流程(flow流表查询)
- 兄弟连学Python(3)—python求职简历
- 使用HashSet<String>将map集合去重
- AngularJs添加删除排序Y
- 实验四
- 《揭秘Angular 2》-Typescript 函数
- Java 多线程学习笔记 4 多线程共享数据