gpt4 book ai didi

javascript - 从数据库获取数据时不能显示更多

转载 作者:行者123 更新时间:2023-11-27 22:42:42 28 4
gpt4 key购买 nike

我从数据库中获取新闻数量,但例如当我最大新闻限制时,我总共收到 24 条新闻,则标签“下载更多新闻”¡

一切都按其应有的方式进行,但它必须消失,这样人们就无法“下载更多新闻”按钮。

只是为了表明您无法下载更多新闻

索引.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>

加载.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 &lt; Newslist.length">
Download more news</button>
</div>
</div>

关于javascript - 从数据库获取数据时不能显示更多,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38637360/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com