ajax调用期间Angular.js智能表加载符号

时间:2015-10-22 06:15:37

标签: javascript angularjs jsp

http://lorenzofox3.github.io/smart-table-website使用pipe / ajax插件示例我一直在尝试使用加载指示器实现Angular.js智能表,而我的ajax调用仍在加载。

角boostrap.js

var eposWebAngularStrutsApp = angular.module('eposWebAngularStrutsApp', ['ngResource','smart-table']);

角controller.js

eposWebAngularStrutsApp.controller('StoreHealthCheckController', ['$scope','StoreServerHealth', function ($scope, StoreServerHealth) {
    //http://www.sitepoint.com/creating-crud-app-minutes-angulars-resource/

    var ctrl = this;
    this.displayed = [];

    this.callServer = function callServer(tableState) {

        ctrl.isLoading = true;
        StoreServerHealth.query(function(result) {          
            ctrl.displayed = result.data;
            ctrl.isLoading = false;
          }); //query() returns all the entries    
    };  

}]);

角service.js

eposWebAngularStrutsApp.factory('StoreServerHealth', function($resource) {
      return $resource('json/storeHealthCheckList.action'); // Note the full endpoint address
    }); 

我的JSP ......

<table class="table table-striped" st-pipe="mc.callServer" st-table="mc.displayed" ng-controller="StoreHealthCheckController">
    <thead>
    <tr>
        <th>Store</th>
        <th>Server</th>
        <th>Conn Status</th>
        <th>Last Updated</th>
        <th>MDI</th>
        <th>Last Synched (MDI)</th>
        <th>DSM</th>
        <th>Last Synched (DSM)</th>
        <th>Trading Status</th>
        <th>Build</th>
    </tr>
    </thead>
    <tbody ng-show="!mc.isLoading">
    <tr ng-repeat="row in mc.displayed">
        <td>{{row.locationId}}</td>
        <td>{{row.clientId}}</td>
        <td>{{row.status}}</td>
        <td>{{row.displayLastUpdateTime}}</td>
        <td>{{row.replicationStatus}}</td>
        <td>{{row.displayLastReplicationSyncTime}}</td>
        <td>{{row.dsmReplicationStatus}}</td>
        <td>{{row.dsmLastSynchTime}}</td>
        <td>{{row.storeTradingStatus}}</td>
        <td>{{row.buildVersion}}</td>   
    </tr>
    </tbody>
    <tbody ng-show="mc.isLoading">
    <tr>
        <td colspan="10" class="text-center">Loading ... </td>
    </tr>   
    </tbody>
</table>

但我一直收到错误TypeError:href是null firebug / content / debugger / stackFrame / StackFrame.js。

有人能让我知道我在这里做错了什么。

由于

1 个答案:

答案 0 :(得分:0)

上面发表的评论是这个问题的答案。我忘记了Alias控制器。