/*
    Loadable object work with load more buttom and
    Spring pageable
*/
var Loadable =function(){};

/*
    The properites to of Loadable
*/
Loadable.prototype.page = 0;
Loadable.prototype.size = 9;
Loadable.prototype.finished = false;
Loadable.prototype.entities = new Object();
Loadable.prototype.stateTexts = { more : "加载更多", loading: "更多加载中...", nomore: "没有了"};
Loadable.prototype.loadingState = Loadable.prototype.stateTexts.more;
Loadable.prototype.arguments = {};

Loadable.prototype.part = new Array();
Loadable.prototype.all = new Array();

// The build method to initlizate the loadable object
Loadable.prototype.build = function(Entity){

    // The resource and the entities
    this.Entity = Entity;

    // Initlizate the entities
    this.entities = { content: new Array() };

}

Loadable.prototype.get = function (callback){

    // Make the reference to the entities
    var entities = this.entities;

    // Make the reference to the stateTexts
    var stateTexts = this.stateTexts;

    // Make the reference to the loadable
    var loadable = this;

    // Get the entities of new page
    var newPage = this.Entity.get(
        $.extend({}, {page: this.page, size: this.size}, this.arguments), function(){

            /*
                Check the lastPage flag and set stateTexts
            */
            if (newPage.lastPage){

                // Get the last page of the Notes,
                // Change the state of the loading state and turn on finished
                loadable.loadingState = stateTexts.nomore;
                if (!loadable.finished) {
                    entities.content = entities.content.concat(newPage.content);
                }
                loadable.finished = true;

            } else {
                loadable.finished = false;
                loadable.loadingState = stateTexts.more;
                entities.content = entities.content.concat(newPage.content);
                loadable.page ++;
            }
        });

    // Invoke the callback
    if (callback && typeof callback === 'function') { callback(); };
};

angular.module('loadableServices', []).
    factory('Loadable', function () {

        // Dependency injection
        return Loadable;
    });

@@ -1064,24 +1064,289 @@
 le = this;%0A%0A
+    // Change the state of the loading state%0A    loadable.loadingState = stateTexts.loading;%0A    %0A    // Make the reference to the callback%0A    if (typeof callback === 'function') %7B%0A        this.callback = callback; %0A    %7D%0A    var getCallback = this.callback;%0A    %0A
     // Get t
@@ -1842,16 +1842,49 @@
 finished
+ %7C%7C entities.content.length === 0
 ) %7B%0A    
@@ -2279,13 +2279,21 @@
     
-%7D);%0A%0A
+    %0A        
     
@@ -2323,13 +2323,24 @@
     
-if (c
+        if (getC
 allb
@@ -2349,25 +2349,28 @@
 k && typeof 
-c
+getC
 allback === 
@@ -2383,17 +2383,20 @@
 ion') %7B 
-c
+getC
 allback(
@@ -2401,20 +2401,33 @@
 k(); %7D;%0A
+        %7D);%0A
 %7D;%0A%0A
+%0A
 angular.

Fix bug of loadable and make teacher statistics campus worked