2016-02-12 76 views

回答

2

當創建您的存儲空間,可以通過在選項對象

let storage = new Storage(SqlStorage, options); 

的SqlStorage服務支持這些選項:

let options = { 
    name: '__ionicstorage',    // the name of the database 
    backupFlag: SqlStorage.BACKUP_LOCAL, // where to store the file 
    existingDatabase: false    // load this as an existing database 
}; 

所以,你應該設置existingDatabase爲true,確保name匹配您的數據庫,並將backupFlag設置爲指向更正位置。

相關的文檔是在這裏: http://ionicframework.com/docs/v2/api/platform/storage/SqlStorage/

源也很容易遵循:​​

+3

感謝您的詳細回答。相關的文檔沒有提及「選項」。 但我還有一個問題,現有數據庫的位置是什麼?在ionic1中,我將它放在'www'文件夾內'。 –

相關問題