Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with LoadingOption when I want set new loadingController

Hi I'm new on Ionic and I have this error when I want create new loadingScreen.

Argument of type '{ content: string; }' is not assignable to parameter 
of type 'LoadingOptions'.
Object literal may only specify known properties, and 'content' does not exist in type 'LoadingOptions'.

I see documentation and I think the syntax is good.

   const loading = await this.loadingController.create({
        content: 'Please wait...',
    });
    await loading.present();
like image 724
Matthis.h Avatar asked Dec 07 '25 11:12

Matthis.h


1 Answers

Looks like their docs are outdated, here is the interface definition in their code:

https://github.com/ionic-team/ionic/blob/master/core/src/components/loading/loading-interface.ts

export interface LoadingOptions {
  spinner?: SpinnerTypes | null;
  message?: string;
  cssClass?: string | string[];
  showBackdrop?: boolean;
  duration?: number;
  translucent?: boolean;
  animated?: boolean;

  mode?: Mode;
  keyboardClose?: boolean;
  id?: string;

  enterAnimation?: AnimationBuilder;
  leaveAnimation?: AnimationBuilder;
}

As you can see, there is no content anymore, it has been renamed to message.

like image 189
Martin Adámek Avatar answered Dec 10 '25 03:12

Martin Adámek