Giter Club home page Giter Club logo

ngdropbox's Introduction

ngDropbox

ngDropbox is a Dropbox Core API Client for AngularJS adapted from dropbox-js. It should be familiar to dropbox-js users as well as idiomatic to AngularJS.

Status

This module is extracted from an AngularJS application. It mostly satisfies the needs of that project but I'm working (as of 1/4/2014) in my spare time to implement the rest of the API. If you want to use ngDropbox but something is missing or doesn't work as expected, please submit an issue or get in touch to pair program. Thanks in advance!

Install

Bower is the quickest way to include ngDropbox in your project.

$ bower install [email protected]:christiansmith/ngDropbox.git --save

<script src="bower_components/ngDropbox/dropbox.js"></script>

If you don't use Bower, just download dropbox.js into your scripts directory.

$ curl -O https://raw.github.com/christiansmith/ngDropbox/master/dropbox.js

<script src="your/js/path/dropbox.js"></script>

Usage

After you create an app in the Dropbox App Console, add an OAuth Redirect URI pointing to https://<HOST>/components/ngDropbox/callback.html.

In your AngularJS app, load the module. Inform your app of the App key and Redirect URI, then inject the service into your controllers and start making API calls. All methods that communicate with the API return promises.

// load the module
angular.module('myApp', ['dropbox'])

  .config(function (DropboxProvider) {
    DropboxProvider.config(<APP_KEY>, <REDIRECT_URI>);
  })

  // inject the service
  .controller('DropboxCtrl', function ($scope, Dropbox) {
    
    // assign a promise to scope
    $scope.accountInfo = Dropbox.accountInfo();

    // or use callbacks
    Dropbox.copy('dir/image1.jpg', 'dir/image2.jpg').then(function (res) {
      Dropbox.move('dir/image1.jpg', 'dir/image.jpg').then(function (res) {
        $scope.photos = Dropbox.stat('dir');
      });
    });

  });

API

TODO

Methods yet to be implemented (as of 8/1/2013).

  • signOut/signOff
  • writeFile
  • resumableUpload
  • makeUrl
  • readThumbnail
  • makeCopyReference/copyRef
  • pullChanges/delta

Other

  • Support redirect and other authentication methods in addition to browser popup
  • Test in multiple browsers
  • Test error cases

Development

Installing the Karma test runner with npm install karma -g, then run the tests with karma start.

Copyright and License

The library is Copyright (c) 2013 Christian Smith, and distributed under the MIT License.

ngdropbox's People

Contributors

christiansmith avatar muratcorlu avatar

Watchers

 avatar  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.