Model Factory

Backend communication made easy!

cloud_download Install it

Installing model-factory is as easy as getting it from bower.

Alternatively you can download a release manually.

Open Releases

$ bower install angular-model-factory --save
face Use it

angular.module('myModule', ['modelFactory'])
    .factory('PersonModel', function($modelFactory){
        return $modelFactory('/api/people');

Create a new angular factory and use the provided $modelFactory service to define a new model.

The default configuration is as easy as this, but there's more to discover.

You can now start using it, by injecting the previously defined PersonModel into your controller, directive or service.

angular.module('app', ['modelFactory'])
    // defining a new Person model
    .factory('Person', function($modelFactory){
        return $modelFactory('/api/people');
    .controller('PersonController', function(Person){
        var vm = this;
        vm.peopleList = [];

        // events
        vm.savePerson = savePerson;
        vm.deletePerson = deletePerson;



        function activate(){
                vm.peopleList = people;

        function savePerson(person){
            // person is already an instance of a model factory
            // model
                    console.log('Person successfully saved!');
                    console.error('Oops, there was an error saving the person');

        function deletePerson(person){
flash_on Features

Angular Model Factory is packed of features, and we're working on providing many more!

  • URI Templates (RFC6570)
  • Model instances
  • Collections
  • Single Datastore
  • Caching / Cache invalidation
  • Default value population
  • Pending / Completed Status
  • Relationships
  • Object Deep Diff / Reversion
  • Track active promises to prevent duplicate sends
  • ...