Skip to content

Commit d7916d8

Browse files
committed
httpDemo
1 parent d3643f4 commit d7916d8

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

control/studentCtrl.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@
1313
var app = angular.module("angularDemo", []);
1414
//第三部是写一个控制器,控制器方法controller()需要传两个参数,一个是控制器的名字,一个是控制器所要执行的回调方法
1515
//$scope,
16-
app.controller('studentCtrl', function($scope, $rootScope) {
16+
//app.controller('studentCtrl', function($scope, $rootScope) {
17+
app.controller('studentCtrl',['$scope', '$rootScope',function($scope, $rootScope){
18+
19+
}])
20+
//$.ajax().each();//链式调用
21+
//注入服务$scope,function($scope){
22+
// $scope.
23+
//}
24+
1725
//$http.get(function(){
1826
//});
1927
//var text, name ,func = function(){alert("124")}; js所在函数的作用域

view/add.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1>添加新闻</h1> 标题:
1+
<h1>添加同学</h1> 标题:
22
<form class="form-horizontal">
33
<div class="form-group">
44
<input type="text" ng-model="title" class="form-control" placeholder="名字"><br /> 内容:

view/route2.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<title></title>
7+
</head>
8+
9+
<body ng-app="angularRouteDemo">
10+
<section ng-controller="homeCtrl">
11+
<p>{{test}}</p>
12+
</section>
13+
</body>
14+
<script>
15+
var app = angular.module('angularRouteDemo', []);
16+
app.controller('homeCtrl', ['$scope', '$http', function($scope, $http) {
17+
$scope.test = "123";
18+
}])
19+
</script>
20+
21+
</html>

0 commit comments

Comments
 (0)