运行时错误 无法读取未定义的属性"_getPortal"



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

   <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是这样的:

{
  "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"
}

当我单击视图中的选择时,它会崩溃,运行时错误堆栈如下所示:

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

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

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

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

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

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

希望这会帮助周围的一些人

相关内容

  • 没有找到相关文章

最新更新