My code logic is as follows, I want to implement it:
Click the query button to turn on the timer. The button text changes to Stop Query,
Click to stop query and cancel the schedule
$scope.submitRequest = function () {
if ($scope.onlyButton == "查询") {
$scope.onlyButton = "停止查询";
$interval(function()
{
//具体方法
}
,5000);
}
else{
setTimeout(function(){
$scope.onlyButton = "查询";
$interval.cancel(stop);
},0)
};
}
But I failed to cancel the timer, please help...
LZ’s code can completely make a status mark outside, for example:
Then use it directly in VIEW like this:
I think it’s better to write like this~