Coder Social home page Coder Social logo

dcww's Introduction

Book session on Codementor

DC Web Women Code(Her) Ionic Framework Sample App

##About This Project This is a simple application that was used to demonstrate the Ionic Framework

The application allows the user to take pictures and save them to a in memory cache or if you set up Parse.com you can save the images to a parse datastore in the cloud. Images are saved with a caption, photo data and a timestamp

alt tag alt tag

##More Images

##Installation Steps for Running Project

  • It is assumed that you have and Android or IOS development environment installed
  • It is assumed you have node and npm installed

####High Level Installation Steps

  • Install Ionic http://ionicframework.com/getting-started/
    • this process will download phonegap/cordova for you
    • ngCordova is used, but already included in repo, more information here: http://ngcordova.com/docs/
    • we will be using angularjs, that is bunded with ionic, see more information on AngularJS
  • Download Code from repo
  • Add missing bower and node modules
    • enter command bower update
    • enter command sudo npm update -g ionic
  • Add back the plugins that are not included in repo
    • enter command cordova plugin add org.apache.cordova.camera
    • enter command cordova plugin add org.apache.cordova.statusbar
    • enter command cordova plugin add org.apache.cordova.console
    • enter command cordova plugin add org.apache.cordova.device
    • enter command cordova plugin add com.ionic.keyboard
  • Add in the platforms
    • enter command ionic platform android
    • enter command ionic platform ios

##Parse Integration as Requested in the workshop The application demonstrates the use of Angular Services for persistence. There is a Parse implementation, ParseImageService and a memory based implementation, ImageService. The application currently is configured to use ParseImageService; this requires that you set your own parse credentials in the application.

You will need to create an application in Parse.com and create a Custom Object with a field picture that is of type File and another field caption of type String.

When you browse your data, it should look like this.

![alt tag](doc/Screenshot 2014-09-14 18.34.33.png)

For additional information, see the Parse.com website for Getting Started

###ImageModel to Support both Interfaces The data object that is returned from a parse query is not a simple javascript hash so there was a need to create a model object that would convert the objects returned from the default ImageService into some object that has the same interface as a Parse.com object so we would not need two UI implementations.

 /**
  *  This is a helper model that is created to allow the application UI to work with the
  *  local datastore and the parse datastore without modifications
  *
  * @param _params
  * @returns {{id: *, createdAt: *, get: get, set: set}}
  * @constructor
  */
 var ImageModel = function (_params) {
     var _data = {};

     /**
      * initialize object to act like a parse.com object
      
      * @param _params
      * @private
      */
     this.set = function (_params) {

         if (!_params) {
             return;
         }

         this.id = _params.id;
         this.createdAt = _params.timestamp;


         _data['createdAt'] = _params.timestamp;
         _data.caption = _params.name;
         _data.id = _params.id;
         _data.picture = { _url: _params.data};

     };
     /**
      *
      * @param _key
      * @returns {*}
      * @private
      */
     this.get = function (_key) {
         return _data[_key]
     };

     this.set(_params);

 };

####Parse Integration and Basic Local Storage Open the app.js file and modify the code below to use your credentials. If you set any of the credentials to an empty string, the application will still work, but it will utilize the default image service and not use parse

 .value('parseConfiguration', {
     applicationId: "YOUR APPLICATION ID",
     javascriptKey: "YOUR JAVASCRIPT KEY"
    USING_PARSE : true
 })

for

####Ui-Router and resolve for Parse Integration This funny looking code for initializing Parse.com that is in app.js is the resolve functionality of the ui-router. You can find additional documentation here https://github.com/angular-ui/ui-router/wiki#resolve

usingParse: function ($q, $timeout, ParseConfiguration) {

    if (ParseConfiguration.applicationId && ParseConfiguration.javascriptKey) {
        console.log("parse initialize");
        Parse.initialize(ParseConfiguration.applicationId, ParseConfiguration.javascriptKey);
    } else {
        ParseConfiguration.USING_PARSE = false
    }

    return ParseConfiguration.USING_PARSE;

}

Ionic Video Series - Subscribe on YouTube Channel

http://www.clearlyinnovative.com/wp-content/uploads/2015/07/blog-cover-post-2.jpg

dcww's People

Contributors

aaronksaunders avatar

Watchers

James Cloos avatar Riq Abuirshaid 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.