Ionic version: (check one with "x")
[ ] 1.x
[ ] 2.x
[ x] 3.x
I'm submitting a ... (check one with "x")
[ x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
After http request, i get this error:
Unhandled Promise rejection: no views in the stack to be removed ; Zone:
Error: Uncaught (in promise): no views in the stack to be removed
Expected behavior:
Steps to reproduce:
Related code:
let loader = this.loadingCtrl.create({
content: contentLoader
});
loader.present();
this.news = [];
this.newsTop = [];
this.dataService.loadNews(Constant.API_ENDPOINT_STIRI, topParams).subscribe(data => {
if (data.status == 200) {
this.mappingService.getNews(data.data.stiri).forEach((topArticles) => {
this.newsTop.push(topArticles);
})
} else {
this.setState('Aplica葲ia nu poate comunica cu serverul.');
}
}, (err) => {
loader.dismissAll();
this.setState('Eroare. Posibil ca aplica葲ia s膬 nu fie conectat膬 la internet.');
}, () => {
this.dataService.loadNews(Constant.API_ENDPOINT_STIRI, params).subscribe(data => {
this.mappingService.getNews(data.data.stiri).forEach((articles) => {
this.news.push(articles);
loader.dismissAll();
})
},(err) => {
loader.dismissAll();
this.notify('Nu s-au putut 卯ncarca articolele.');
throw new Error(JSON.stringify(err));
}, () => {
this.dataService.loadNews(Constant.API_ENDPOINT_STIRI, secondParams).subscribe(data => {
this.mappingService.getNews(data.data.stiri).forEach((articles) => {
articles.secondNews = 1
this.news.push(articles);
})
},(err) => {
this.notify('Nu s-au putut 卯ncarca articolele.');
throw new Error(JSON.stringify(err));
}, () => {
if (this.news.length == 0 && this.newsTop.length == 0)
{
this.setState('Nu s-a g膬sit nici un articol.');
}
this.currentPage++;
this.firstLoadCompleted = true;
});
});
});
}
insert any relevant code here
Other information:
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
insert the output from ionic info here
Hello! Thanks for opening an issue with us! As this seems like more of a support question I will urge that you ask this question on our forum or on our [slack channel](https://ionicworldwide.herokuapp.com/]. Thanks for using Ionic!
Just to inform that I also have this error which is related to loader.dismissAll(). When you call it twice it throws this error.
It would be great if loader.dismissAll()checked if there are any loaders present and do nothing if none exist. I have loader.dismissAll() in multiple parts of my code (depending on certain conditions) and sometimes more than one runs and this error is thrown. I guess I could put my own if statements before each dismissAll()
I am having the same issue and I agree with @efares, it would be nice.
i fixed it with this it may help
```
constructor(
public loadingCtrl: LoadingController
) {
this.loader = this.loadingCtrl.create({
content: this.loadingText
});
this.loader.onDidDismiss(() => {
this.loaderStatus = false;
console.log('Dismissed loading');
});
});
}
loader: any;
loaderStatus: any;
public loadingText: any = 'Loading';
showLoading() {
// this.loader = this.loadingCtrl.create({
// content: this.loadingText
// });
this.loader.present();
this.loaderStatus=true;
setTimeout(() => {
this.loader.dismiss();
}, 5000);
}
hideLoading() {
if(this.loaderStatus){
this.loader.dismiss();
}
}
```
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
Just to inform that I also have this error which is related to
loader.dismissAll(). When you call it twice it throws this error.