当我从数据库中获取数据时不能显示更多
Must not display more when I get data from database
我从数据库中获取新闻数量,但是例如当我最大限制新闻时我总共收到 24 条新闻,那么标签 "download more news"¨
一切都正常播放,但它必须恰到好处,以至于无法按 "download more news" 按钮。
只是为了说明您不能下载更多新闻
Index.Html
<div class="col-md-12" ng-app="NewsLoad" ng-controller="ListNews">
<ul class="team-list sort-destination">
<li class="col-md-4 col-sm-6 col-xs-12 isotope-item leadership" ng-repeat="New in Newslist | limitTo: totalDisplayed" style="max-height:380px; float:left;">
@*html here*@
</li>
</ul>
<div class="form-group col-md-12" style="margin-top:23px;">
<button class="btn-block btn btn-info" ng-click="change()">Download more news</button>
</div>
</div>
Load.js
var app = angular.module('NewsLoad', []);
app.controller('ListNews', function ($scope, $http) {
$scope.totalDisplayed = 9;
$scope.change = function () {
$scope.totalDisplayed += 6;
}
var url = "/Nyheder/all";
$http.get(url).success( function(response) {
$scope.Newslist = response;
});
})
尝试如下的 ng-show 表达式:
<div class="col-md-12" ng-app="NewsLoad" ng-controller="ListNews">
<ul class="team-list sort-destination">
<li class="col-md-4 col-sm-6 col-xs-12 isotope-item leadership" ng-repeat="New in Newslist | limitTo: totalDisplayed" style="max-height:380px; float:left;">
@*html here*@
</li>
</ul>
<div class="form-group col-md-12" style="margin-top:23px;">
<button class="btn-block btn btn-info" ng-click="change()"
ng-show="totalDisplayed < Newslist.length">
Download more news</button>
</div>
</div>
我从数据库中获取新闻数量,但是例如当我最大限制新闻时我总共收到 24 条新闻,那么标签 "download more news"¨
一切都正常播放,但它必须恰到好处,以至于无法按 "download more news" 按钮。
只是为了说明您不能下载更多新闻
Index.Html
<div class="col-md-12" ng-app="NewsLoad" ng-controller="ListNews">
<ul class="team-list sort-destination">
<li class="col-md-4 col-sm-6 col-xs-12 isotope-item leadership" ng-repeat="New in Newslist | limitTo: totalDisplayed" style="max-height:380px; float:left;">
@*html here*@
</li>
</ul>
<div class="form-group col-md-12" style="margin-top:23px;">
<button class="btn-block btn btn-info" ng-click="change()">Download more news</button>
</div>
</div>
Load.js
var app = angular.module('NewsLoad', []);
app.controller('ListNews', function ($scope, $http) {
$scope.totalDisplayed = 9;
$scope.change = function () {
$scope.totalDisplayed += 6;
}
var url = "/Nyheder/all";
$http.get(url).success( function(response) {
$scope.Newslist = response;
});
})
尝试如下的 ng-show 表达式:
<div class="col-md-12" ng-app="NewsLoad" ng-controller="ListNews">
<ul class="team-list sort-destination">
<li class="col-md-4 col-sm-6 col-xs-12 isotope-item leadership" ng-repeat="New in Newslist | limitTo: totalDisplayed" style="max-height:380px; float:left;">
@*html here*@
</li>
</ul>
<div class="form-group col-md-12" style="margin-top:23px;">
<button class="btn-block btn btn-info" ng-click="change()"
ng-show="totalDisplayed < Newslist.length">
Download more news</button>
</div>
</div>