How to stop If statement, keeps on showing

image

The $ionicpopup keeps on showing because of the if statement , I am confused why does the popup keeps on showing when I already canceled it. I already tried to stop the alarm and the set time but still it’s on loop with true condition. I dont know what I’ve missed,

put clearTimeout(timeoutID); stement in confirmPopup.then function and also declare timeoutID in the controller function

you are using the assignment operator “=” instead of the equality operator “==” in your if(playalarm… expression