在角度js控制器中获得无限循环,未捕获错误:[$ rootScope:infdig]

时间:2016-03-22 15:50:13

标签: jquery angularjs html5

JSP(代码的一部分)

<tr ng-repeat="eachlowerstack in configdata.lowerstack">
    <td>
        <p ng-model="detail(eachlowerstack.integration.id)">{{eachlowerstack.integration.id}}</p><br>
        <span>Name: {{config.name}}</span><br>
        <span>Platform: {{config.platform}}</span><br>
        <span>Version: {{config.version}}</span><br>
        <span>Level: {{config.level}}</span><br>
    </td>

控制器:

$scope.detail = function(integid) {


    $scope.url1 = contextPath + "/getlowerstackdetails/"+integid;
    console.log($scope.url1);

    DependecyInject.getData($scope.url1).then(function(result) {
        $scope.config = result.data;
        console.log($scope.config);
        console.log($scope.config.name);
        console.log($scope.config.platform);
        console.log($scope.config.version);
        console.log($scope.config.level);
        //console.log($scope.configdata.lowerstack.integration.id);
    });
};

在运行时我从后端得到响应,但它会进入无限循环:

  

angular.js:38未捕获错误:[$ rootScope:infdig] http://errors.angularjs.org/1.5.0/ $ rootScope / infdig?p0 = 10&amp; p1 =%5B%5D

1 个答案:

答案 0 :(得分:0)

使用&#34; ng-init &#34;而不是&#34; ng-model&#34;