我創建在其中,我有一個表秀angularjs表,如果表中有一行
<div class="table-responsive scroll" ng-hide="hidetable">
<table id="table" class="table table-bordered table-condensed">
<thead>
<tr class="bg-primary">
<th><a href="#" class="erp-tb-a" ng-click="order('date')">Date</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('day')">Day</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('brandname')">BrandName</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('zone')">Zone</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('location')">Location</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('area')">Area</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('trainer')">TrainerName</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('program')">Program</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('trainingno')">Training Id</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('amount')">Amount</a></th>
<th><a href="#" class="erp-tb-a">Remark</a></th>
<th><a href="#" class="erp-tb-a" ng-click="order('sonvinid')">SonvinId</a></th>
<th><a href="#" class="erp-tb-a" ></a>Add</th>
</tr>
<tr class="bg-primary">
<td><input type="text" class="erp-input" ng-model="search.date" /></td>
<td><input type="text" class="erp-input" ng-model="search.day" /></td>
<td><input type="text" class="erp-input" ng-model="search.brandname" /></td>
<td><input type="text" class="erp-input" ng-model="search.zone" /></td>
<td><input type="text" class="erp-input" ng-model="search.location" /></td>
<td><input type="text" class="erp-input" ng-model="search.area" /></td>
<td><input type="text" class="erp-input" ng-model="search.trainer" /></td>
<td><input type="text" class="erp-input" ng-model="search.program" /></td>
<td><input type="text" class="erp-input" ng-model="search.trainingno" /></td>
<td><input type="text" class="erp-input" ng-model="search.amount" /></td>
<td><input type="text" class="erp-input" /></td>
<td><input type="text" class="erp-input" ng-model="search.sonvinid" /></td>
<td></td>
</tr>
</thead>
<tbody>
<tr ng-repeat="p in getallcompany | orderBy:predicate:reverse | filter:search">
<td>{{p.date}}</td>
<td>{{p.day}}</td>
<td>{{p.brandname}}</td>
<td>{{p.zone}}</td>
<td>{{p.location}}</td>
<td>{{p.area}}</td>
<td>{{p.trainer}}</td>
<td>{{p.program}}</td>
<td>{{p.trainingno}}</td>
<td>{{p.amount}}</td>
<td><input type="text" class="erp-input" style="width:90%; border:1px solid black;" ng-model="mdremarks" /></td>
<td>{{p.sonvinid}}</td>
<td><md-checkbox tabindex="0" area-label="none" role="checkbox" ng-click="clickcheckbox()"></md-checkbox></td>
</tr>
</tbody>
</table>
<div style="margin-bottom:20px">
<a href="#" style="cursor:pointer;" class="btn btn-primary active">Generate Bill</a>
<a href="#" style="cursor:pointer;" class="btn btn-warning active">Back</a>
</div>
</div>
這是我的表,我的第一個div我用
ng-hide="hidetable"
mvc5 angularjs一個基於Web的應用程序
現在我想要的是如果表是空的(即)如果從sql返回的值沒有行,表應該隱藏,如果返回的值有行,表應該顯示
var app = angular.module('myapp', ['ngMaterial']);
app.controller('mycontroller', function ($scope, $http) {
$scope.hidetable = true;
,這是我的控制器和表將在頁面加載
$http.get('/freezeservice.asmx/gettabledetails', {
params: {
log: log,
pm: pm,
comname: $scope.mdcompany,
mm: $scope.datemm,
yy: $scope.dateyy
}
})
.then(function (response) {
{
$scope.getallcompany = response.data.info;
}
});
被隱藏這就是我如何獲取我的數據
需要你的幫助
它不應該是一個像ng-if =「getallcompany.length> 0」的布爾表達式嗎? –
這也很好 –