ending timeout function, with button click
Hi everyone,
i am still a rookie with JavaScript and I think this is not that difficult, but i can't find a solution.
I have an Animation, where I want to make some labels visible after some time (4.5 sec and 6.5sec) at Step 2, I use this code, which works fine:
$scope.widgets_playStarted = function(){
if($scope.view.wdg['model-1']['currentStep'] == 2){
$timeout(function(){
$scope.view.wdg["label_1"].visible = true;
}, 4500)
$timeout(function(){
$scope.view.wdg["label_2"].visible = true;
}, 6500)
}
I also have a Stop-Button. With this I want to stop the animation, but I can't stop the timeout function. So when I click "Stop" the animation stops but the label still gets visible after the 4.5 and 6.5 seconds.
So how do I also cancel the timeout function with the click on the Stop button?
Thank you very much!

