2016-07-17 90 views
-1

enter image description here離子2角2 - 爲什麼顯示空白屏幕?

enter image description here

我下面這個教程 - http://javebratt.com/firebase-3-email-auth/ 當我運行的代碼一切工作順利,除了首頁。登錄後的首頁上沒有顯示和瀏覽器控制檯顯示錯誤..

請幫助解決錯誤 - 原始異常:類型錯誤:無法讀取的不確定

import {LoginPage} from './pages/login/login'; 
import {HomePage} from './pages/home/home'; 
import * as firebase from 'firebase'; 
import {Component} from '@angular/core'; 
import {ionicBootstrap, Platform} from 'ionic-angular'; 
import {StatusBar} from 'ionic-native'; 

@Component({ 
    template: '<ion-nav [root]="rootPage"></ion-nav>', 
}) 
export class MyApp { 
    rootPage: any; 

    constructor(platform: Platform) { 
     platform.ready().then(() => { 
      // Okay, so the platform is ready and our plugins are available. 
      // Here you can do any higher level native things you might need. 
      StatusBar.styleDefault(); 
     }); 

     // Initialize Firebase 
     var config = { 
      apiKey: "*********", 
      authDomain: "*********", 
      databaseURL: "*********", 
      storageBucket: "********" 
     }; 
     firebase.initializeApp(config); 

     //an observer for the user object. By using an observer, 
     //you ensure that the Auth object isn’t in an intermediate 
     //state—such as initialization—when you get the current user. 
     firebase.auth().onAuthStateChanged((user) => { 
      if(user) { 
       //console.log(user); 
       //If there's a user take him to the Home page. 
       this.rootPage = HomePage; 
       //this.rootPage = LoginPage; 
       //console.log(user); 
      } else { 
       //If there's no user logged in send him to the Login page 
       this.rootPage = LoginPage; 
      } 
     }); 
    } 
} 

ionicBootstrap(MyApp); 

回答

0

import {Component} from '@angular/core'; 
 
import {Platform, ionicBootstrap} from 'ionic-angular'; 
 
import {StatusBar} from 'ionic-native'; 
 
import {HomePage} from './pages/home/home'; 
 
import {LoginPage} from './pages/login/login'; 
 
import * as firebase from 'firebase';
財產「參數」