forked from DuncanHuang/angularjs-cn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
148 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<div><strong>Subject:</strong> {{message.subject}}</div> | ||
<div><strong>Sender:</strong> {{message.sender}}</div> | ||
<div><strong>Date:</strong> {{message.date}}</div> | ||
<div> | ||
<div class="detail-item"><strong>Subject:</strong> {{message.subject}}</div> | ||
<div class="detail-item"><strong>Sender:</strong> {{message.sender}}</div> | ||
<div class="detail-item"><strong>Date:</strong> {{message.date}}</div> | ||
<div class="detail-item"> | ||
<strong>To:</strong> | ||
<span ng-repeat='recipient in message.recipients'>{{recipient}} </span> | ||
</div> | ||
<div>{{message.message}}</div> | ||
<div class="detail-msg">{{message.message}}</div> | ||
<a href='#/'>Back to message list</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
###说明: | ||
|
||
这个实例需要借助服务器环境运行, 实例中给出了一个简单的PHP返回JSON数据. 在应用程序的HTML页面中使用`$http()`函数发起对这个php文件的请求, 最后将根据响应的数据构建出如下图所示结果界面: | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!doctype html> | ||
<html lang="en" ng-app> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>服务器通信</title> | ||
<script src="../../js/angular.min.js"></script> | ||
<style> | ||
table { | ||
border-collapse: collapse; | ||
border-spacing: 0; | ||
} | ||
table td { | ||
border: 1px solid #ccc; | ||
padding: 5px; | ||
line-height: 26px; | ||
} | ||
</style> | ||
</head> | ||
<body ng-controller="ShoppingController"> | ||
<h1>Products</h1> | ||
<table> | ||
<tr ng-repeat="item in items"> | ||
<td>{{item.title}}</td> | ||
<td>{{item.description}}</td> | ||
<td>{{item.price | currency}}</td> | ||
</tr> | ||
</table> | ||
<script> | ||
function ShoppingController($scope, $http){ | ||
$http.get('server.php').success(function(data, status, headers, config){ | ||
$scope.items = data; | ||
}); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
header('Cntent-type: text/json'); | ||
|
||
$items = array( | ||
array('id' => 0, "title" => "Paint pots", "description" => "Pots full of paint", "price" => 3.95), | ||
array("id" => 1, "title" => "Polka dots", "description" => "Dots with that polka groove", "price" => 12.95), | ||
array("id" => 2, "title" => "Pebbles", "description" => "Just little rocks, really", "price" => 6.95) | ||
); | ||
$return = json_encode($items); | ||
|
||
print_r($return) ; | ||
|
||
?> |