2017-05-19 32 views
1

財產「_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 

一切這麼簡單,我不明白什麼是問題。

+0

你有叫'_getPortal'東西在你的代碼? –

+0

不,我還沒有在我的源代碼中使用任何名爲「門戶」。 錯誤來自main.js _getPortal in main.js它用於最終編譯代碼中: App.prototype.getActiveNav = function(){ var/** @type {?} */portal = this._appRoot ._getPortal(__ WEBPACK_IMPORTED_MODULE_2__app_constants __ [「b」/ * PORTAL_MODAL * /]); (portal.length()> 0){ return findTopNav(portal); } return findTopNav(this._rootNav || null); }; – coenni

+0

錯誤發生在main.js中的這一行中 App.prototype.present = function(enteringView,opts,appPortal){*} assert * /; var/** @type {?} */portal = this._appRoot._getPortal(appPortal); // Set Nav必須在此處設置以便dimiss()同時工作。 // TODO:將_setNav()移動到NavController的早期階段。 _queueTrns() enteringView._setNav(portal); – coenni

回答

0

我在我的應用程序中有相同的錯誤消息。該錯誤是由定製組件模塊文件創建的:components.module.ts

我添加了這個導入條目IonicModule.forRoot(MyCustomComponent)

之後,沒有辦法使警報,加載等工作。

溶液去除.forRoot(MyCustomComponent)

希望這將幫助一些人圍繞

相關問題