亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Angular.JS讀取數(shù)據(jù)庫數(shù)據(jù)調(diào)用完整實例

 更新時間:2019年07月02日 11:21:50   作者:火紅橘子  
這篇文章主要介紹了Angular.JS讀取數(shù)據(jù)庫數(shù)據(jù)調(diào)用,結(jié)合完整實例形式分析了AngularJS使用$http.get方法與后臺php交互讀取數(shù)據(jù)庫數(shù)據(jù)相關(guān)操作技巧,需要的朋友可以參考下

本文實例講述了Angular.JS讀取數(shù)據(jù)庫數(shù)據(jù)調(diào)用。分享給大家供大家參考,具體如下:

以下是實例代碼:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<style>
table{position:relative;}
table, th , td {
 border: 1px solid grey;
 border-collapse: collapse;
 padding: 10px 20px;
}
table tr:nth-child(odd) {
 background-color: #f1f1f1;
}
table tr:nth-child(even) {
 background-color: #ffffff;
}
i{display:block;background:url(buffer.gif) no-repeat;position:absolute;left:50%;margin-left:-16px;top:50px;width:32px;height:32px;}
</style>
</head>
<body>
<center style="margin-top:100px;">
<div ng-app="myApp" ng-controller="customersCtrl">
<h3>數(shù)據(jù)統(tǒng)計</h3>
<table>
 <tr>
  <th>活動編號</th>
  <th>活動名稱</th>
  <th>點擊量</th>
  <th>最后訪問時間<i id="buffer"></i></th>
  <th>所屬欄目</th>
 </tr>
 <tr ng-repeat="x in names">
  <td>{{ x.sid }} </td>   <!--活動編號-->
  <td>{{ x.sname }} </td>  <!--活動名稱-->
  <td>{{ x.sclick }} 次</td>  <!--點擊量-->
  <td>{{ x.stime | date:'yyyy-MM-dd HH:mm:ss' }}</td>  <!--最后訪問時間-->
  <td>{{ x.sproject }}</td>  <!--所屬欄目-->
 </tr>
</table>
</div>
</center>
<script>
var buffer = document.getElementById("buffer");
buffer.style.display = 'block';
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
  $http.get("Customers_MySQL.php")
  .success(function (response) {
      $scope.names = response;
      buffer.style.display = 'none';  //成功調(diào)取數(shù)據(jù)之后
  });
  //成功調(diào)取mysql數(shù)據(jù),將response.records改為response,因為它是個對象
});
</script>
</body>
</html>

更多關(guān)于AngularJS相關(guān)內(nèi)容可查看本站專題:《AngularJS指令操作技巧總結(jié)》、《AngularJS入門與進階教程》及《AngularJS MVC架構(gòu)總結(jié)

希望本文所述對大家AngularJS程序設(shè)計有所幫助。

相關(guān)文章

最新評論