AngularJS错误:[$ rootScope:inprog] $ digest在使用Spring rest获取数据时已经在进行中

时间:2015-02-09 22:46:51

标签: java javascript angularjs rest spring-mvc

我尝试通过Spring rest和AngularJS从数据库中获取数据,但我得到了这个 错误:

[$rootScope:inprog] $digest already in progress
http://errors.angularjs.org/1.2.26/$rootScope/inprog?p0=%24digest

代码:

@RequestMapping(value = "/rest/assets",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public List<Asset> getAll() {
    log.debug("REST request to get all Assets");
    List<Asset> assets=assetService.getAllOrderByIdDesc();
    return assetService.getAllOrderByIdDesc();
}

rout.js

 adapApp
   .config(function ($routeProvider, $httpProvider, $translateProvider
       , USER_ROLES) {
        $routeProvider
            .when('/asset', {
                templateUrl: 'views/assets.html',
                controller: 'AssetController',
                resolve:{
                    resolvedAsset: ['Asset', function (Asset) {
                        return Asset.query().$promise;
                    }]
                },
                access: {
                    authorizedRoles: [USER_ROLES.all]
                }
            })
    }); 

service.js

adapApp.factory('Asset', function ($resource) {
    return $resource('app/rest/assets/:id', {}, {
        'query': { method: 'GET', isArray: false},
        'get': { method: 'GET'}
    });
 });

控制器

adapApp.controller('AssetController', function ($scope, resolvedAsset
      , Asset ) {
$scope.assets = resolvedAsset;
});

html page

<tr ng-repeat="asset in assets">
                    <td>{{asset.id}}</td>
                    <td>{{asset.assetName}}</td>
                    <td>{{asset.locations[0]}}</td>
                    <td>{{asset.airport.iatacode}}</td>
                    <td>{{asset.lastupdateUserid}}</td>
                    <td>{{asset.lastupdateDateTime}}</td>
                    <td>{{asset.domainName}}</td>
                    <td>
 <tr>

0 个答案:

没有答案