Giter Club home page Giter Club logo

todolite-ionic's Introduction

Couchbase TodoLite for Ionic Framework

Todo Lite Android Todo Lite iOS

Requirements

  • Apache Cordova 5.0+
  • Couchbase Lite PhoneGap SDK
  • Apache Cordova Whitelist Plugin
  • Apache Cordova Camera Plugin

Configuration

Installing Dependencies

After cloning the repository, run the following from your Terminal (Mac / Linux) or Command Prompt (Windows), with the project as your current working directory, to add dependencies:

Automatic

Let Ionic install the platforms and plugins from package.json:

ionic state reset

Manual

Add the platforms:

ionic platform add android
ionic platform add ios

Then install all the required plugins:

cordova plugin add cordova-plugin-whitelist
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-console
cordova plugin add cordova-plugin-splashscreen
cordova plugin add ionic-plugin-keyboard
cordova plugin add https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin.git

Resolving Gradle Conflicts For Android

At compile time, you may run into the following error message:

Error: duplicate files during packaging of APK

To resolve this, you must extend the Gradle build file for Android as outlined in the official Apache Cordova documentation.

Create platforms/android/build-extras.gradle in your project and add the following:

android {
	packagingOptions {
		exclude 'META-INF/ASL2.0'
		exclude 'META-INF/LICENSE'
		exclude 'META-INF/NOTICE'
	}
}

Usage (Android & iOS)

To build and run the project for Android, run the following from your Terminal or Command Prompt:

ionic build android
adb install -r platforms/android/build/outputs/apk/android-debug.apk

For iOS, run ionic build ios and open the Xcode project file found in the platforms/ios directory.

Usage (Sync Gateway)

This sample application can connect to the Couchbase Sync Gateway to keep data in sync across devices and platforms. To use with Sync Gateway, first download the latest version from the Couchbase website. Extract the downloaded copy and from your Command Prompt (Windows) or Terminal (Linux / Mac) execute the following:

/path/to/sync/gateway/bin/sync_gateway /path/to/ionic/project/sync-gateway-config.json

This will start the Sync Gateway using the configuration file provided in this project. It will be serving on http://localhost:4984 and http://localhost:4985.

Depending on your choice of device or emulator, the host address information found in your project's www/js/app.js file might differ.

Resources

Couchbase Lite REST API - http://developer.couchbase.com/mobile/develop/references/couchbase-lite/rest-api/index.html

todolite-ionic's People

Contributors

jamesnocentini avatar nraboy avatar swaheed2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

todolite-ionic's Issues

createDatabase() throws an error thats not really an error

Won't createDatabase throw an error when database already exists (error 412)? Although that is not an actual error, createDesignDocument and the listen method won't run.

todoDatabase.createDatabase().then(function(result) {
var todoViews = {...}
todoDatabase.createDesignDocument("_design/todo", todoViews);
todoDatabase.listen();
},function(error) {
console.error(JSON.stringify(error));
});

What I had to do in my app was something like this:

todoDatabase.createDatabase().then(function(result) {
var todoViews = {...}
todoDatabase.createDesignDocument("_design/todo", todoViews);
todoDatabase.listen();
},function(error) {
console.error(JSON.stringify(error));
if(err.status === 412) {
console.log("databse already exists: ");
// database already exists
var todoViews = {...}
todoDatabase.createDesignDocument("_design/todo", todoViews);
todoDatabase.listen();
}
else {
// err creating database
deferred.reject(err);
}
});

couchbase:change event not firing

I used your project as an ionic starter template from this github repo. When I run things, the 'couchbase:change' event does not seem to fire when a task item is added or deleted. If I navigate away and back to the list, the new item appears (or, deleted item disappears). So, the document add/delete is happening. But, when I put a break on the $rootscope.$on('couchbase:change'... It is never hit. Thoughts?

createDatabase() throws an error thats not really an error

Won't createDatabase throw an error when database already exists (error 412)? Although that is not an actual error, createDesignDocument and the listen functions won't run.

todoDatabase.createDatabase().then(function(result) {
    var todoViews = {...}
    todoDatabase.createDesignDocument("_design/todo", todoViews);
    todoDatabase.listen();
},function(error) {
    console.error(JSON.stringify(error));
});

What I had to do in my app was something like this:

todoDatabase.createDatabase().then(function(result) {
    var todoViews = {...}
    todoDatabase.createDesignDocument("_design/todo", todoViews);
    todoDatabase.listen();
},function(error) {
    console.error(JSON.stringify(error)); 
    if(err.status === 412) {
        console.log("databse already exists: ");
        // database already exists
        var todoViews = {...}
        todoDatabase.createDesignDocument("_design/todo", todoViews);
        todoDatabase.listen();
    }
    else {
        // err creating database
        deferred.reject(err);
    }
});

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.