AngularJS SQL - MySQL을 실행하는 PHP 서버에서 데이터 가져 오기

· 8년 전 · 1997
AngularJS SQL - MySQL을 실행하는 PHP 서버에서 데이터 가져 오기

<div ng-app="myApp" ng-controller="customersCtrl">

<table>
<tr ng-repeat="x in names">
<td>{{ x.Name }}</td>
<td>{{ x.Country }}</td>
</tr>
</table>

</div>

<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("customers_mysql.php")
.then(function (response) {$scope.names = response.data.records;});
});
</script>

<!DOCTYPE html>
<html >
<style>
table, th , td {
border: 1px solid grey;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd) {
background-color: #f1f1f1;
}
table tr:nth-child(even) {
background-color: #ffffff;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>

<div ng-app="myApp" ng-controller="customersCtrl">

<table>
<tr ng-repeat="x in names">
<td>{{ x.Name }}</td>
<td>{{ x.Country }}</td>
</tr>
</table>

</div>

<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("customers_mysql.php")
.then(function (response) {$scope.names = response.data.records;});
});
</script>

</body>
</html>
|
댓글을 작성하시려면 로그인이 필요합니다.

퍼블리싱강좌

+
분류 제목 글쓴이 날짜 조회
AngularJS
[AngularJS]
8년 전 조회 1,513
AngularJS 8년 전 조회 1,530
AngularJS
[AngularJS]
8년 전 조회 1,578
AngularJS
[AngularJS]
8년 전 조회 1,611
AngularJS
[AngularJS]
8년 전 조회 1,610
AngularJS
[AngularJS]
8년 전 조회 1,155
AngularJS
[AngularJS]
8년 전 조회 1,505
AngularJS 8년 전 조회 1,420
AngularJS 8년 전 조회 1,385
AngularJS 8년 전 조회 1,552
AngularJS 8년 전 조회 1,341
AngularJS 8년 전 조회 1,395
AngularJS 8년 전 조회 1,505
AngularJS 8년 전 조회 1,261
AngularJS 8년 전 조회 1,998
AngularJS 8년 전 조회 1,571
AngularJS 8년 전 조회 1,223
AngularJS 8년 전 조회 1,533
AngularJS 8년 전 조회 1,309
AngularJS 8년 전 조회 1,120
AngularJS 8년 전 조회 2,092
AngularJS 8년 전 조회 1,168
AngularJS 8년 전 조회 1,231
AngularJS 8년 전 조회 1,424
AngularJS 8년 전 조회 1,274
AngularJS 8년 전 조회 1,466
AngularJS 8년 전 조회 1,480
AngularJS 8년 전 조회 1,250
AngularJS 8년 전 조회 1,218
AngularJS 8년 전 조회 1,619