2016-11-05 17 views
2

を適用する$を使用せずに、すでに進行中で適用されます。

$scope.fav_details = function(id1,id2,bio) { 
    document.getElementById(id2).style.display="none"; 
    document.getElementById(id1).style.display="block"; 
    $scope.getLegislatorDetails(bio); 
    document.getElementById(bio).click(); 
} 

次のエラーがスローされた行は、上記のクリックイベントです。 私が理解していないことは、私のコードのどこにでも$ applyを適用しなかったことですが、私はまだこのエラーを受けています。誰かが私を助けることができる?上記のコードのgetLegislatorDetails関数はapi呼び出しを持ち、スコープ変数にデータを格納します。 私は、次の角度JSのエラーがあります。

angular.js:13642 Error: [$rootScope:inprog] http://errors.angularjs.org/1.5.6/$rootScope/inprog?p0=%24apply 
    at Error (native) 
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:6:412 
    at n (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:137:381) 
    at m.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:145:312) 
    at HTMLButtonElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:274:247) 
    at HTMLButtonElement.dispatch (http://localhost/congress/js/jquery-3.1.1.min.js:3:10315) 
    at HTMLButtonElement.q.handle (http://localhost/congress/js/jquery-3.1.1.min.js:3:8342) 
    at m.$scope.fav_details (http://localhost/congress/scripts.js:938:38) 
    at fn (eval at compile (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:231:126), <anonymous>:4:436) 
    at b (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:126:19)(anonymous function) @ angular.js:13642 
angular.js:13642 Error: [$rootScope:inprog] http://errors.angularjs.org/1.5.6/$rootScope/inprog?p0=%24apply 
    at Error (native) 
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:6:412 
    at n (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:137:381) 
    at m.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:142:30) 
    at m.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:145:401) 
    at HTMLButtonElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:274:247) 
    at HTMLButtonElement.dispatch (http://localhost/congress/js/jquery-3.1.1.min.js:3:10315) 
    at HTMLButtonElement.q.handle (http://localhost/congress/js/jquery-3.1.1.min.js:3:8342) 
    at m.$scope.fav_details (http://localhost/congress/scripts.js:938:38) 
    at fn (eval at compile (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js:231:126), <anonymous>:4:436)(anonymous function) @ angular.js:13642 

getLegislatorDetails機能は、以下のリンクで見つけることができます: - ケースであなたはバイオについて

ng-click=getLegislatorDetails 

を添付

https://github.com/anirbanmishra/congress.php/blob/master/getLegislatorDetails

+0

これはコントローラ内のコードであると仮定しています。あなたは、コントローラ内でDOM操作を行うべきではありません。 '$ scope.lgetLegislatorDetails'コードを表示できますか? –

+0

はい、上記のコードはコントローラ内にあります。getLegislatorDetails関数は次の場所にあります: - https://github.com/anirbanmishra/congress.php/blob/master/getLegislatorDetails – Anirban

+0

@NexusDuck any clue? – Anirban

答えて

0

を要素

then commen次のコードからの任意の行

$scope.getLegislatorDetails(bio); 
     document.getElementById(bio).click(); 
関連する問題