javascript - Must not display more when I get data from database -


i number of news database, example when max limit of news such receive 24 news in total, tag "download more news"¨

everything plays should, must away such 1 can not "download more news" button.

just show can not 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;      });  }) 

try ng-show expression below:

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

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -