Code Monkey home page Code Monkey logo

storage01's Introduction

STORAGE APP - IONIC 1 & cordova-plugin-sqlite & ng-cordova


Tutorial :  Use SQLite Instead of Local Storage In Ionic Framework
Tutorial Video : https://www.youtube.com/watch?v=lxrsT4n86YI
Tutorial Article : https://blog.nraboy.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/
links : https://www.npmjs.com/package/cordova-plugin-sqlite


Storage IONIC App  Project in c9.io :

	Name of the C9 project : storage01
		
	Name of the IONIC App project : storage01

		1- go to c9.io
		2- create  a new node.js project : storage01
		3- open a terminal in the storage01 workspace project
		4- tape in the terminal :
		 a	-  npm install -g cordova ionic
		 b	-  ionic start storage01 blank
		
		5- download the : last version of ng-cordova and copy ng-cordova.min.js file in the  nameProject/nameApp/www/js
		 - in this case : copy ng-cordova.min.js file in  storage01/storage01/www/js/
		
		6- tape in the terminal
		 a	-  cd storage01
		 b  -  cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
	   c 	-  ionic serve -p $PORT
	

Fix Errors Storage IONIC App  Project in c9.io

		Error 1 : TypeError: Cannot read property 'openDatabase' of undefined
       		Solution
			-replace in www/app.js :   db = $cordovaSQLite.openDB("my.db");
			-by      : 
			if(window.cordova){ 
			  db=$cordovaSQLite.openDB({ name: "my.db" }); //device 
			  } else {
             db=window.openDatabase("my.db",'1','my',1024 *1024 *100); //window 
            }

		



Storage IONIC App  Project in LocalComputer :

	Name of the Directory project : IonicProjects
		
	Name of the IONIC App project : storage01

		1- open a terminal in windows : cmd
		2- in the terminal create a new Ionic Project directory : mkdir IonicProjects
		3- tape in the termianl
			-  cd IonicProjects
		 	-  npm install -g cordova ionic
			-  ionic start storage01 blank
			
		4- download the : last version of ng-cordova and copy ng-cordova.min.js file in the  nameProject/nameApp/www/js
		
		5- in this case : copy ng-cordova.min.js file in  storage01/storage01/www/js/
			-  cd storage01
			-  cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
			-  ionic serve 

Fix  Errors Storage IONIC App  Project in LocalComputer : 

	Error 1 : Error processing SQL: TypeError: window.openDatabase is not a function
       	Solution
	You are using Web SQL Database, which is not supported by Firefox. Also, the specification is abandoned by the W3C.

	- in this casr use chorme not firefox
	Source : http://stackoverflow.com/questions/18605614/error-processing-sql-typeerror-window-opendatabase-is-not-a-function
	  SET DEFAULT Browser to chrome in IONIC 1 peoject :
	  1 - Edit name_of_porject/www/ionic.project file 
    2 - Add this line    "defaultBrowser": "chrome",
	
	
		Error 2: TypeError: Cannot read property 'openDatabase' of undefined
       		Solution
			-replace in www/app.js :   db = $cordovaSQLite.openDB("my.db");
			-by      : if(window.cordova){ db=$cordovaSQLite.openDB({ name: "my.db" }); //device } else {
            db=window.openDatabase("my.db",'1','my',1024 *1024 *100); //window }
	

storage01's People

Contributors

ngalphadev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.