不以html显示

时间:2018-09-27 18:25:00

标签: java html angularjs

我想用index.html上的angularjs设计表。 然后显示index.html并可以,但是->whereRaw('MONTH(prescriptions.prescibe_date) = MONTH(CURDATE())'); -不显示...

我放了index.html:

<tbody ng-init="getAll()"

app.js:

<table class="table table-hover">
            <tr>
                <th>ID</th>
                <th>Employee Name</th>
                <th>Age</th>
                <th>Department</th>
                <th></th>
                <th></th>
            </tr>
            <tbody ng-init="getAll()">
                <tr ng-repeat="d in employees">
                <td>{{d.id}}</td>
                <td>{{d.name}}</td>
                <td>{{d.designation}}</td>
                <td>{{d.expertise}}</td>
                <td>
                    <button class="btn btn-warning" ng-click="editInfo(d.id)" title="Edit"><span class="glyphicon glyphicon-edit"></span></button>
                </td>
                <td>
                    <button class="btn btn-danger" ng-click="deleteInfo(d.id)" title="Delete"><span class="glyphicon glyphicon-trash"></span></button>
                </td>
        </tr>
    </tbody>
            </table>

我的网络应用程序: enter image description here

我该如何解决?

1 个答案:

答案 0 :(得分:0)

确定要从$http调用中获取数据。您的角度代码正确无误,对我来说很好。

如果$scope.employees中没有数据,您还可以添加一些文本

尝试一下:

angular.module("myapp", [])
  .controller("mycontroller", function($scope, $timeout, $http) {
    $scope.employees = [];

    $timeout(function() {
      $scope.employees = [{
          id: 1,
          name: 'Aagam',
          designation: 'Developer',
          expertise: 'Java Script'
        },
        {
          id: 2,
          name: 'Akshay',
          designation: 'Developer',
          expertise: 'python'
        }
      ];
    }, 3000);

    /*$http.get('employees').then(function(response, status, header, config) {
      $scope.employees = response.data;
    });*/
  });
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myapp" ng-controller="mycontroller">
  <div ng-hide="employees && employees.length">
    No-Data Available
  </div>
  <table class="table table-hover" ng-show="employees && employees.length">
    <tr>
      <th>ID</th>
      <th>Employee Name</th>
      <th>Age</th>
      <th>Department</th>
      <th></th>
      <th></th>
    </tr>
    <tbody ng-init="getAll()">
      <tr ng-repeat="d in employees">
        <td>{{d.id}}</td>
        <td>{{d.name}}</td>
        <td>{{d.designation}}</td>
        <td>{{d.expertise}}</td>
        <td>
          <button class="btn btn-warning" ng-click="editInfo(d.id)" title="Edit"><span class="glyphicon glyphicon-edit"></span></button>
        </td>
        <td>
          <button class="btn btn-danger" ng-click="deleteInfo(d.id)" title="Delete"><span class="glyphicon glyphicon-trash"></span></button>
        </td>
      </tr>
    </tbody>
  </table>
  <div>