2016-02-12 75 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'文件夹内'。 –

相关问题