@shitsod wrote:
Hi,
I switched to Ionic v4 recently and I have some troubles with LoadingController.I do not succeed to cancel it (when I got an error).
I got my function in my component :
async loadingLogin() { const loading = await this.loadingController.create({ message: 'Connexion ...', showBackdrop: true, id: 'login' }); return await loading.present(); }
When the user log in, I launch the loadingController. If the login succeeds, I can cancel it.
But if it fails, I can’t cancel the spinner :@Input() set pending(isPending: boolean) { if (isPending) { this.loadingLogin(); } else { this.loadingController.dismiss('login'); } } @Input() set error(error: HttpErrorResponse) { if (error) { this.loadingController.dismiss(null, null, 'login'); this.loadingController.dismiss('login'); } }
Here is my package.json and I got the angular type of Ionic project :
"dependencies": { "@angular/common": "~6.1.1", "@angular/core": "~6.1.1", ... "@ionic-native/core": "5.0.0-beta.15", "@ionic-native/network": "5.0.0-beta.15", "@ionic-native/splash-screen": "5.0.0-beta.15", "@ionic-native/status-bar": "5.0.0-beta.15", "@ionic/angular": "4.0.0-beta.7", ... },
Posts: 1
Participants: 1