最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

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

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

以下是實(shí)例代碼:

<!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)計(jì)</h3>
<table>
 <tr>
  <th>活動編號</th>
  <th>活動名稱</th>
  <th>點(diǎn)擊量</th>
  <th>最后訪問時(shí)間<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>  <!--點(diǎn)擊量-->
  <td>{{ x.stime | date:'yyyy-MM-dd HH:mm:ss' }}</td>  <!--最后訪問時(shí)間-->
  <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,因?yàn)樗莻€(gè)對象
});
</script>
</body>
</html>

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

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

相關(guān)文章

最新評論

富源县| 鱼台县| 京山县| 北川| 夹江县| 惠来县| 江津市| 大余县| 潍坊市| 达孜县| 民勤县| 廉江市| 宁海县| 双桥区| 红原县| 彭泽县| 泰和县| 勃利县| 杭锦后旗| 巩义市| 若尔盖县| 嘉定区| 乃东县| 渝中区| 东乡县| 广灵县| 龙口市| 合作市| 全州县| 新巴尔虎右旗| 抚顺县| 西乡县| 平果县| 都昌县| 越西县| 长子县| 平阳县| 丹巴县| 定边县| 武乡县| 乌拉特后旗|