小编Sim*_*mon的帖子

离子4-AlertController:属性“ present”不存在-角度?

我正在Ionic 4中设置新警报-空白类型:角度项目。这是基本警报,但是我在运行项目时遇到错误。

错误

属性“ present”在类型“ Promise”上不存在。您忘了使用“等待”吗?

我创建与文档中相同的代码。链接:https//ionicframework.com/docs/api/components/alert/AlertController/

我的代码:

import { AuthenticationService } from './../../services/authentication.service';
import { Component, OnInit } from '@angular/core';
import { AlertController, LoadingController, NavController } from 
'@ionic/angular';

@Component({
  selector: 'app-register',
  templateUrl: './register.page.html',
  styleUrls: ['./register.page.scss'],
})
export class RegisterPage implements OnInit {
  createSuccess = false;
  registerCredentials = { email: '', password: '' };

 constructor(
   private nav: NavController,
   private auth: AuthenticationService,
   private alertCtrl: AlertController) { }

 ngOnInit() {
 }

 presentAlert() {
    const alert = this.alertCtrl.create({
    message: 'Low …
Run Code Online (Sandbox Code Playgroud)

mobile-application ionic-framework ionic-native ionic4

6
推荐指数
2
解决办法
1万
查看次数