0
Angular JS newbee question.각도 JS 상세 검색
나는 데이터베이스에서 데이터를 얻을 수있는 컨트롤러를했습니다 :
var app = angular.module('myApp', []);
app.controller('myAppCtrl', ['$scope', '$http', function ($scope, $http) {
$http.get("views/resumen.pedidos.php")
.success(function (data) {
$scope.results = data;
});
이 데이터는 테이블에 표시됩니다
<body ng-app="myApp">
<div ng-controller="myAppCtrl" class="row top-row">
<table id="data-table" border="0" width="100%" cellpadding="0" cellspacing="0" class="table panel">
<thead>
<tr>
<th>PEDIDO</th>
<th>ESTADO WEB</th>
<th>FECHA</th>
<th>HORA</th>
<th>PREPARAR</th>
<th>CANTIDAD</th>
<th>PREPARADO</th>
<th>ENVIO</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="result in results">
<td>{{ result.pedido }}</td>
<td>{{ result.estado_web | uppercase }}</td>
<td>{{ result.fecha }}</td>
<td>{{ result.hora }}</td>
<td>{{ result.preparar }}</td>
<td>{{ result.cantidad }}</td>
<td>{{ result.enviado }}</td>
<td>{{ result.envio }}
</tr>
</tbody>
</table>
</div>
</body>
테이블 행을 클릭하면 내가 다른 컨트롤러에서 데이터를 표시 할 {{result.pedido}}를 키 값으로 사용합니다.
app.controller('myAppDetailCtrl', ['$scope', '$http', function ($scope, $http) {
$http.get("views/detalle.pedidos.php")
.success(function (data) {
$scope.results = data;
});
options, First : 행을 클릭하면 행 데이터를 서비스에 주입하고이 서비스에서 데이터를 가져옵니다. 두 가지 : URL로 데이터를 전달하고'$ location.search(); '를 사용하여 가져옵니다. – Isma90