离子2角度2 - 为什么显示空白屏幕?

时间:2016-07-17 18:08:30

标签: ionic-framework firebase firebase-realtime-database ionic2

enter image description here

enter image description here

我遵循本教程 - http://javebratt.com/firebase-3-email-auth/ 当我运行代码时,除了主页之外,一切都很顺利。登录后,主页面不显示,浏览器控制台显示错误..

请帮助解决错误 - 原始异常:TypeError:无法读取属性'参数'未定义的

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);

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
private List<List<string>> ReadExcelFile(string fileName)
    {
        Excel.Application xlApp = null;
        Workbook xlWorkbook = null;
        Sheets xlSheets = null;
        Worksheet xlSheet = null;
        var results = new List<List<string>>();

        try
        {
            xlApp = new Microsoft.Office.Interop.Excel.Application();

            xlWorkbook = xlApp.Workbooks.Open(fileName, Type.Missing, true, Type.Missing, Type.Missing, Type.Missing, true, XlPlatform.xlWindows, Type.Missing,false, false, Type.Missing, false, Type.Missing, Type.Missing);

            xlSheets = xlWorkbook.Sheets as Sheets;

            xlSheet = xlSheets[1];

            // Let's say your range is from A1 to DG5200
            var cells = xlSheet.get_Range("A1", "DG5200");

            results = ExcelRangeToListsParallel(cells); 
        }
        catch (Exception)
        {
            results = null;
        }
        finally
        {
            xlWorkbook.Close(false);
            xlApp.Quit();

            if (xlSheet != null)
                Marshal.ReleaseComObject(xlSheet);
            if (xlSheets != null)
                Marshal.ReleaseComObject(xlSheets);
            if (xlWorkbook != null)
                Marshal.ReleaseComObject(xlWorkbook);
            if (xlApp != null)
                Marshal.ReleaseComObject(xlApp);
            xlApp = null;                
        }

        return results;
    }

    private List<List<String>> ExcelRangeToListsParallel(Excel.Range cells)
    {            

        return cells.Rows.Cast<Excel.Range>().AsParallel().Select(row =>
        {         
            return row.Cells.Cast<Excel.Range>().Select(cell =>
            {
                var cellContent = cell.Value2;                    
                return (cellContent == null) ? String.Empty : cellContent.ToString(); 
            }).Cast<string>().ToList();                
        }).ToList();
    }
&#13;
&#13;
&#13;