1
이 이상한 문제가 있습니다. bizzare 이유로 인해 setInterval
은 $http.get()
이 없으면 작동하지 않습니다. 현재, $http
은 상기 간격을 호스트하는 제어기에 대한 의존성으로서 설정된다. 그러나 내가 그들을 없애면 (의존성과 전화 모두) setInterval
이 작동을 멈 춥니 다. 이 문제를 어떻게 해결해야할지 모르겠습니다. 여기
이 의존성을 제거한 후 컨트롤러
main.controller('timeCtrl', function($scope, $http, clockService) {
$scope.time = clockService.timeBase();
setInterval(function() {
$http.get();
$scope.time = clockService.timeBase();
}, 500);
});
에 대한 코드입니다,이
main.controller('timeCtrl', function($scope, clockService) {
$scope.time = clockService.timeBase();
setInterval(function() {
$scope.time = clockService.timeBase();
}, 500);
});
처럼 보인다 그러나 그것은 작동하지 않습니다. 도대체 틀린거야?