1

我从数据库中获得新闻的数量,但是例如当我收到新闻的最大限制时,我总共收到24条新闻,则标签“下载更多新闻”¨当我从数据库中获取数据时,不能显示更多信息

所有事情都应该发挥作用,但它必须离开,以至于无法“下载更多新闻”按钮。

为了表明您不能下载更多的新闻

的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; 
    }); 

}) 
+0

当没有更多显示你w蚂蚁隐藏“下载更多新闻”按钮? – kukkuz

+0

是的。我想知道,我应该在div按钮上抛出'ng-show =“”'。但这只是它对我缺乏的规定。 –

回答

1

尝试如下的NG-节目表达:

<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> 
+1

感谢您的帮助!我跳你会给我+1我的问题。 –

相关问题