Just a little problem : I'm making an Hybrid app developed in angular with Cordova but when I use a setInterval() function after a $window.open() the setInterval stop working, but in chrome it's working (but it's normal, the new window is opened in a new tab).
This is the an extract of my code :
$http.post(url)
.success(function(result, status) {
var windowWithings = $window.open(result.res);
var intervalVerif = $window.setInterval(function (){
$http.get(url)
.success(function(result) {
windowWithings.close();
$window.cancelInterval(intervalVerif);
})
.error(function(error) {
console.log(error);
});
}, 2000);
})
.error(function(error, status) {
console.log(status);
});
Thanks by advance !
EDIT :
What I searching to do with the setInterval is to check each 2000 ms if the server got the informations from the new window I have opened. If it's ok for the server I close the window to comeback to the previous.
When I say it's not working I want to say that the new window doesn't close but if I change the code whith an alert I can see sometimes an alert before new window had the time to open but nothing after
For Chrome, I just say that if I open the angular app in chrome on my laptop its working, but if I launch my Android app created with Cordova it doesn't work.
please use $timeout and add '$timeout' in injection parameters
$timeout(function (){
$http.get(url)
.success(function(result) {
windowWithings.close();
$window.cancelInterval(intervalVerif);
})
.error(function(error) {
console.log(error);
});, 2000);