Toast.present is not a function


I have Problem in toast.present();

My code Html

type or paste code here
```<ion-content padding>
  <form (ngSubmit)="FormReg()" padding>
      <ion-input type="email" [(ngModel)]="" name="email"></ion-input>
      <ion-input [(ngModel)]="" name="pw"></ion-input>
      <ion-label>Confirm password</ion-label>
      <ion-input [(ngModel)]="todo.confirm_pw" name="confirm_pw"></ion-input>
    <ion-button ion-button type="submit" color="primary" expand="full">Sign In</ion-button>

My code ts

```import { Component, OnInit } from '@angular/core';

import { HttpClient } from '@angular/common/http'

import {  ToastController } from '@ionic/angular';

  selector: 'app-register',
  templateUrl: './',
  styleUrls: ['./'],
export class RegisterPage implements OnInit {

    private http:HttpClient,
    public toastController: ToastController,
    { }

  ngOnInit() {

    let toast = this.toastController.create({
      message: 'Toast Message',
      duration: 3000




I am at the moment on ionic 4, but assume it is on ionic 3 similar.
On Ionic 4 .create(… returns a promise, but you nether await it or use .then (promise like syntax) The code line toast.present(), which is a promise too, will, due to asyncrounous code executing, be executed before the toast is ‘created’ and the variable toast has no member present() at this time.

Change it to

async FormReg(){
    let toast = await this.toastController.create({
      message: 'Toast Message',
      duration: 3000
    return await toast.present();


Best regards, anna-liebt


Thanks anna , the problem has been resolved :wink: