question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v4: Error while trying to use LoadingController

See original GitHub issue

Bug Report

Ionic Info

Ionic:

   ionic (Ionic CLI)          : 4.0.0-rc.11 (C:\Users\admin\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework            : @ionic/angular 4.0.0-alpha.11
   @angular-devkit/core       : 0.7.0-rc.2
   @angular-devkit/schematics : 0.7.0-rc.2
   @angular/cli               : 6.0.8
   @ionic/ng-toolkit          : 1.0.0-rc.11
   @ionic/schematics-angular  : 1.0.0-rc.11

System:

   NodeJS : v8.11.1 (C:\Program Files\nodejs\node.exe)
   npm    : 6.0.1
   OS     : Windows 10

Describe the Bug When trying to use the “LoadingController” in a Component or a Service, the loading.present() method and loading.dismiss() method both get underlined in red color. Intellisense reports the following issues: TS2339: Property 'present' does not exist on type 'Promise<HTMLIonLoadingElement>.' TS2339: Property 'dismiss' does not exist on type 'Promise<HTMLIonLoadingElement>.' Because of the above issue, I am unable to use LoadingController/Spinner in my project.

Steps to Reproduce Steps to reproduce the behavior:

  1. In any component or service, import LoadingController like this: import {LoadingController} from '@ionic/angular';
  2. Add dependency in the constructor: constructor(public loadingCtrl: LoadingController) { }
  3. Add the following method to the component/service:
 presentLoadingDefault() {
        let loading = this.loadingCtrl.create({
            content: 'Please wait...'
        });

        loading.present();

        setTimeout(() => {
            loading.dismiss();
        }, 5000);
    }
  1. The present() and dismiss() methods in the code above, gets highlighted in red color and Intellisense will show this error: TS2339: Property 'present' does not exist on type 'Promise<HTMLIonLoadingElement>.' TS2339: Property 'dismiss' does not exist on type 'Promise<HTMLIonLoadingElement>.'

Related Code Unfortunately, I am unable to setup a demo of this issue using Stackblitz. However, I am attaching a screenshots of these issues below.

Expected Behavior The loading.present(); and loading.dismiss(); should not be highlighted in red i.e. they should not have an error. In the UI, the Loading Spinner should show up normally, whenever the presentLoadingDefault() method is invoked.

Additional Context Here are the screenshots of the issues:

image

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
devner007commented, Jul 20, 2018

@peterpeterparker Your Point 1 is the answer that I was looking for. I will make the changes accordingly.

Thank you so much for all your help! Appreciate it!

1reaction
peterpeterparkercommented, Jul 19, 2018

@devner007 here you go

 async myMethod() {
    const loading = await this.loadingController.create({});
   
  loading.present().then(() => {
       // do your stuffs backend call etc here
       this.yourStuffs().then(() => {
            // Whatever you have still things to do you could do here
            // finally close loading 
            loading.dismiss();
       });
   });
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Dismiss LoadingController In Error Response Of ...
Without any service,. Same issue I faced while using Ionic 4 loading controller. After trial and error I got working solution.
Read more >
Cannot Dismiss LoadingController In Error Response Of ...
I'm able to dismiss the LoadingController when I get a SUCCESS response ... LoadingController In Error Response Of Subscribe() - Ionic 4.
Read more >
Dismissing All Loading Overlays in Ionic 4 - Damir's Corner
If it hasn't, I throw an error to avoid the endless loop caused by repeatedly trying to close the same loading overlay without...
Read more >
Ionic 6 Loading Controller Tutorial with ion-loading Example
Step 1: Getting Started · Step 2: Build Loader Service · Step 3: Import Loading Controller · Step 4: Display Simple Loader ·...
Read more >
EUCON error loading controller personality
Error occurred while trying to load the controller personality "EUCON" My ipad is seen by eucontrol but protools will not allow me to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found