我遇到了一个问题。
angular.js:13424 TypeError: $interval.cancel is not a function at ChildScope.$scope.updatetime
我的代码:
$scope.updatetime = function () {
var current_time = new Date();
$scope.nowitem = {};
var hour = current_time.getHours();
.
.
.
$interval.cancel($scope.checkupdate);
.
.
}
$scope.checkupdate = $interval($scope.updatetime, 1000);
$scope.updatetime();
如何解决这个问题? 提前谢谢。
答案 0 :(得分:0)
确保您已在控制器中通过 $ interval 。像这样:
app.controller('myCtrl', function($scope, $interval) {