2014-11-13 2 views
0

사이트를 상속 받았으며 마지막 부분을 완료하려고합니다. 다른 모든 컨트롤러에 나는

$timeout(function(){ //Issue is this doesn't seem to timeout... 
        $scope.rTapTopNumbersContainer = document.getElementById('rtap-quote-summary'); 
        rTapNotifyDOMChange($scope.rTapTopNumbersContainer); 
       }, 100); 

의 변화를 추가했지만 마지막 컨트롤러에 나는 내가이 곳 순간, 시간 제한에 각도 코드없이 컨트롤러 어디에서나 작동 여부를이 코드를 추가 할 수없는 것 . HTML DOM을 업데이트하려면 제한 시간이 필요합니다.

.success에 넣으면 시간 초과가 작동하지 않는 것 같습니다. 이 코드를 어디에 넣을 수 있습니까? 아니면 $ http가 실행 된 후에이 코드를 호출 할 수 있습니까?

app.controller('summary', ['$scope', '$http', function($scope, $http, $timeout) { 

var init = function() { 
    $http({ 
      method: 'GET', 
      url: $scope.api + 'sites/site/?title=' + $scope.site 
     }). 
      success(function(data, status, headers, config) { 

      ...assign vars to scope etc... 

      $timeout(function(){ //Issue is this doesn't seem to timeout... 
       $scope.rTapTopNumbersContainer = document.getElementById('rtap-summary'); 
       rTapNotifyDOMChange($scope.rTapTopNumbersContainer); 
      }, 100); 

     }). 
      error(function(data, status, headers, config) { 
     }); 
    } 
init(); 
}]); 
+1

오류 부분에 있지 않습니까? –

+1

시간 제한을 올바르게 가져 오지 않았습니다. – SoluableNonagon

+0

또한 물어볼 필요가 없다면 왜 시간 초과가 필요합니까? – SoluableNonagon

답변

2

아마도 $ timeout을 올바르게 가져 오지 않았습니까?

app.controller('summary', ['$scope', '$http', '$timeout', function($scope, $http, $timeout) { // twice 
//       1.   2.  3.     1.  2.  3. 

}]); 
+0

당신은 정확합니다, 고맙습니다. – myol

관련 문제