LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

  
    
    Preloader On Pagination
  
  
    
    

Items

  1. item {{item}}
Loading..
    CSS
    .preloader {
      width: 150px;
      margin: 50px;
    }
    
    JS
    angular
       .module('Preloader', ['ui.bootstrap']);
    
    angular
      .module('Preloader')
      .controller('PreloaderCtrl', PreloaderController)
      .filter('start', function() {
          return function(input, start) {
              return input.slice(start);
          };
      })
      ;
    
          PreloaderController.$inject = ['$timeout'];
          function PreloaderController($timeout)
          {
            var vm = this;
            
            vm.contentLoaded = true;
            vm.itemsCount = 20;
            vm.currentPage = 1;
            vm.pageSize = 5;
            vm.items = [];
            
            for(var i = 0; i < vm.itemsCount; i++)
              vm.items[i] = i + 1;
            
            vm.pageChanged = pageChanged;
            
            function pageChanged()
            {
              vm.contentLoaded = false;
              
              /*Actually, instead of the timeout, there should be some API request, to get new page content.
              Once the response is resolved vm.contentLoaded is set to true.
              */
              $timeout(function(){vm.contentLoaded = true;}, 1000 * (Math.random() + 1));
            }
          }
    Term
    Thu, 02/22/2018 - 14:17

    Related Codes

    Pen ID
    Pen ID
    Pen ID
    Square Adv