2016-10-12 39 views
0

我在www /中有一個名爲'test.db'的現有數據庫。我通過使用cordova文件插件將該文件轉移到android中的正確路徑中嵌入數據庫以在Android設備中工作,如下所示。加載現有的sqlite數據庫,並在鉻離子瀏覽器中運行

$cordovaFile.copyFile(cordova.file.applicationDirectory + 'www/', "test.db", cordova.file.dataDirectory, "test.db") 
    .then(function (success) { 
     console.log('success'); 
     db = $cordovaSQLite.openDB({ name: "test.db"}); 
    }, function (error) { 
     console.log('error file transfer : ', error); 
    }); 

它可以在android設備上使用。但是,我想在瀏覽器中運行該命令,以便通過命令(ionic serve)快速開發應用程序。請告訴我如何嵌入sqlite數據庫並在瀏覽器中運行。

回答

相關問題