Ionic ToastController not showing toast after npm run build

Discussão em 'Angular' iniciado por Dimitar Marinov, Outubro 24, 2024.

  1. The issue is: Using ToastController after build doesn't shows the toast. Its working as expected with npm run serve, but not when builded. Seems like never reaching the point of console.log('Message Toast Service 3');.


    export class MessageToastService {
    toastController = inject(ToastController);

    async show(message?: string, duration: number = 3000, error?: Error ) {
    console.log ('Message Toast 1');
    if (!message && error) {
    message = error.message;
    }
    console.log ('Message Toast 2');

    try {
    const toast = await this.toastController.create({
    message: message,
    duration: duration,
    position: 'bottom',
    color: 'warning',
    });

    console.log ('Message Toast Service 3');
    await toast.present();
    } catch (e) {
    console.log(e);
    }
    }

    }

    Continue reading...

Compartilhe esta Página