运行时错误无法读取未定义的属性“_getPortal” [英] Runtime Error Cannot read property '_getPortal' of undefined

查看:2066
本文介绍了运行时错误无法读取未定义的属性“_getPortal”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的html文件中有一个简单的离子选择组件,如下所示:

I have a simple ion-select component in my html file like this:

   <ion-row><ion-item class="login-item">
        <ion-label floating> Companies</ion-label>
        <ion-select  [(ngModel)]="storeid">
            <ion-option value="1"> store1</ion-option>
            <ion-option value="2"> store2</ion-option>
        </ion-select> 

    </ion-item></ion-row>

我的package.json是这样的:

And My package.json is like this:

{
  "name": "ionic-hello-world",
  "version": "0.0.0",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.0.2",
    "@angular/compiler": "4.0.2",
    "@angular/compiler-cli": "4.0.2",
    "@angular/core": "4.0.2",
    "@angular/forms": "4.0.2",
    "@angular/http": "4.0.2",
    "@angular/platform-browser": "4.0.2",
    "@angular/platform-browser-dynamic": "4.0.2",
    "@ionic-native/core": "3.4.2",
    "@ionic-native/splash-screen": "3.4.2",
    "@ionic-native/status-bar": "3.4.2",
    "@ionic/storage": "2.0.1",
    "angular2-swing": "^0.7.1",
    "ionic-angular": "3.2.1",
    "ionic2-auto-complete": "^1.4.2-release",
    "ionic2-super-tabs": "^2.3.0",
    "ionicons": "3.0.0",
    "ng2-swipe-cards": "^1.0.14",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "^0.8.5"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.6",
    "typescript": "~2.2.1"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "ionic-plugin-keyboard",
    "cordova-plugin-splashscreen"
  ],
  "cordovaPlatforms": [],
  "description": "An Ionic project"
}

当我点击视图中的select时,它会崩溃并且运行时错误堆栈如下所示:

When i click to the select in the view it crashes and runtime error stack is as below:

TypeError: Cannot read property '_getPortal' of undefined
    at App.present (http://localhost:8100/build/main.js:17984:52)
    at Alert.present (http://localhost:8100/build/main.js:49299:26)
    at Select.open (http://localhost:8100/build/main.js:71893:17)
    at Select._click (http://localhost:8100/build/main.js:71758:14)
    at Object.eval [as handleEvent] (ng:///AboutModule/About.ngfactory.js:433:43)
    at handleEvent (http://localhost:8100/build/main.js:12303:138)
    at callWithDebugContext (http://localhost:8100/build/main.js:13511:42)
    at Object.debugHandleEvent [as handleEvent] (http://localhost:8100/build/main.js:13099:12)
    at dispatchEvent (http://localhost:8100/build/main.js:9278:21)
    at http://localhost:8100/build/main.js:9868:38

一切都那么简单,我不明白什么可能是问题。

Everything is so simple and I dont understand what can be the problem.

推荐答案

我的应用程序中出现了相同的错误消息。该错误是从自定义组件模块文件创建的: components.module.ts

I had the same error message in my app. The error was created from custom component module file: components.module.ts.

我添加了此导入条目 IonicModule.forRoot(MyCustomComponent)

此后,无法使警报,加载等工作。

After this, no way to make alert, loading, etc working.

解决方案是删除 .forRoot(MyCustomComponent)

希望这会帮助一些人

这篇关于运行时错误无法读取未定义的属性“_getPortal”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆