Respect your data

Give your data the treatment it deserves with a data store built for Angular.js.

Show me!

Why angular-data?
Inspired by Ember Data, angular-data is the model layer Angular is missing. It consists of a convenient in-memory cache for managing your data, and several adapters for communicating with various persistence layers.


By default angular-data uses the http adapter which is perfect for communicating with your RESTful backend. It comes with a localStorage adapter, and another localforage adapter is also available. More adapters are coming, and you're free to implement your own.


Unlike Backbone and Ember Models, angular-data does not require the use of getters and setters, and doesn't wrap your data with custom classes if you don't want it to. Angular-data's internal dirty-checking (via observe-js or Object.observe in supporting browsers) allows for powerful use cases and an easy avenue for implementing your own 3-way data-binding.


Supporting relations, computed properties, model lifecycle control and a slew of other features, angular-data is the tool for giving your data the respect it deserves.


angular-data.js vs angular-cache.js?
angular-data.js is the full data store that supports collections and communicating with persistence layers. angular-cache.js is a simple key-value store and an api-compatible replacement for $cacheFactory with advanced caching capabilities. Use one, or the other, or use both and angular-data will be able to take advantage of some of the features of angular-cache.


How do I get it?
npm install --save angular-data or bower install --save angular-data then add angular-data.DS as a dependency of your angular app.

npm install --save angular-cache or bower install --save angular-cache then add angular-data.DSCacheFactory as a dependency of your angular app.

Angular-data does not require angular-cache in order to work.

Now what?

Benefits

  • Painless RESTful resource management
  • Model Control and Flexibility
  • Less code to write
  • Less code to test
  • Less code to maintain
  • Improved sense of well-being

Features

  • Model relations
  • CRUD operations
  • Data management
  • Model lifecycle hooks
  • Pluggable Adapters
  • Computable Properties
  • Custom JSON serializers/deserializers
  • Query system for querying server/filtering cache
  • Add custom instance behavior
  • Easy binding to scope

Roadmap

  • Even more adapters
  • You tell me!

Project Status

Project angular-data angular-data-mocks angular-cache
Branch master master master
Bower Bower version Bower version Bower version
NPM NPM version NPM version NPM version
Build Status Build Status Build Status Build Status
Code Climate Code Climate Code Climate Code Climate
Dependency Status Dependency Status Dependency Status Dependency Status
Coverage Coverage Status Coverage Status Coverage Status
License MIT License MIT License MIT License

License

Copyright (C) 2014 Jason Dobry

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.