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.
$ 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'])
There are currently four services. hoodie, hoodieAccount, hoodieStore and hoodieArray.
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.
Use the same API like plain hoodie. Use dependency Injection.
Use the same API like plain hoodie. Use dependency Injection if you want to use this. We recommend you to use hoodieArray
.
Add hoodieArray
to your di-array. With the bind method you could bind an array to your hoodie store.
- 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');
});
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.
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 , usinggrunt 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