A Backbone.Model inspired modellayer for AngularJS
2 people use it
Author: 207248?v=2 bfanger

ActiveRecord for AngularJS

angular-activerecord is an Backbone.Model inspired modellayer for AngularJS.

Differences compared to Backbone.Model

  • Added static fetchOne(id) and fetchAll() methods.
  • No attributes property
  • Because the properties and methods are on the same level the ActiveRecord method & properties are prefixed with "$""
  • Stripped out functionality that is provided by angular)
    • No getter/setter methods
    • No event system.
    • No dependancy on underscore
    • No dependancy on jQuery
    • No Collection class

Goals / Features (compared to $resource)

  • Extendable OOP designed models (instance methods per type, )
  • Enable parsing jsonData
  • Allow default values
  • Allow alternative backends
  • Allow alternative url schemes (like .json suffixed)
  • Minimal configuration (only an urlRoot), the json-object from the rest api is the spec.


    Add "ActiveRecord" as module dependancy.

    The ActiveRecord methods are prefixed with "$" to prevent naming-collisions with properties from your rest api.

comments powered by Disqus
This page was last updated over 5 years ago.