Angular JS详细搜索

时间:2016-12-02 17:30:08

标签: angularjs crud

Angular JS newbee问题。

我有一个控制器来从数据库中获取数据:

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;

});

0 个答案:

没有答案