//需要在控制器内添加$interval服务
$scope.roomLayout = $interval(function(){
$scope.alarm()
},setTime)
$scope.$on('$destroy',function(){
$interval.cancel($scope.roomLayout);
})
$scope.roomLayout = $interval(function(){
$scope.alarm()
},setTime)
$scope.$on('$destroy',function(){
$interval.cancel($scope.roomLayout);
})