Git Product home page Git Product logo

hoodie-plugin-angularjs's Introduction

Dependency Status devDependency Status Build Status

Hoodie goes angular in a cozy way!

A lot is missing, but the good news are: you can contribute!

A little bit about the plugin.

Install

$ hoodie install angularjs in your project folder will install the plugin. You need to load angular BEFORE hoodie.

Initialize hoodie and load the plugin into angular. add the module name hoodie to your module array. Example:

// Init Hoodie
var hoodie  = new Hoodie()
window.hoodie = hoodie;

// Init Angular
angular.module('worldDominationApp', ['hoodie'])

Services

There are currently four services. hoodie, hoodieAccount, hoodieStore and hoodieArray.

hoodie

Use hoodieProvider.url(String) to configure your app's hoodie url at startup. Scroll down for an example.

You can then inject hoodie with dependency injection anywhere to get your plain old hoodie instance. For more angular-friendly services, use the below.

hoodieAccount

Use the same API like plain hoodie. Use dependency Injection.

hoodieStore

Use the same API like plain hoodie. Use dependency Injection if you want to use this. We recommend you to use hoodieArray.

hoodieArray

Add hoodieArray to your di-array. With the bind method you could bind an array to your hoodie store.

hoodieArray.bind(scope, store[, hoodieStore])

  • scope: the scope to bind with. Normaly $scope
  • store: the place were the store binds to.
  • hoodieStore: Optional. the store name in hoodie. If unset, store will be used.

Example:

angular.module('worldDominationApp', ['hoodie'])

.config(function(hoodieProvider) {
  hoodieProvider.url('http://myhoodie.com/_api');
})

.controller('TodoCtrl', function ($scope, hoodieArray) {

  $scope.delete = function(item) {
    var idx = $scope.todos.indexOf(item);
    $scope.todos.splice(idx, 1);
  };

  $scope.add = function (title) {
    $scope.todos.push({
      title: title
    });
    $scope.newTodo = '';
  }

  hoodieArray.bind($scope, 'todos', 'todo');
});

Development

We use grunt to build and karma to test, with bower to install test dependencies. To setup your development environment:

  • grunt
  • npm install
  • bower install

Then, run grunt to build and test. Run grunt dev to start the test server and test every save.

Build & Release Process

Run grunt release, which will do the following;

  • grunt build to concat the source files and wrap them in Hoodie.extend()
  • Move built file from dist to project root , using grunt shell:release. We keep the concatenated file in dist by default so it cannot be accidentally commited.
  • Use grunt bump to commit, tag, and publish

hoodie-plugin-angularjs's People

Contributors

ajoslin avatar boennemann avatar elmarburke avatar locks avatar redgeoff avatar robinboehm avatar

Watchers

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