Sha256: d91a85b4d7c89adae8075ae84d3c8c74187c7aa5c914d6f94b969809be5efe1d

Contents?: true

Size: 1.47 KB

Versions: 4

Compression:

Stored size: 1.47 KB

Contents

angular.module('<%= @plural_model_name%>', ['ngResource']).
  factory('<%= @model_name%>', function($resource) {
  var <%= @model_name%> = $resource('/<%= @plural_model_name%>/:id', {id: '@id'},
                       {
                         update: { method: 'PUT' },
                         destroy: { method: 'DELETE'}
                       }
                      );

  <%= @model_name%>.prototype.destroy = function(cb) {
    return <%= @model_name%>.remove({id: this.id}, cb);
  };

  return <%= @model_name%>;
});
/*
angular.module('<%= @plural_model_name%>', ['ngResource']).
  factory('<%= @model_name%>', function($resource) {
  var <%= @model_name%> = $resource('/<%= @plural_model_name%>/:id',
                       {}, {
                         update: { method: 'PUT' },
                         destroy: { method: 'DELETE'}
                       }
                      );

                      <%= @model_name%>.prototype.update = function(cb) {
                        return <%= @model_name%>.update({id: this._id},
                                           angular.extend({},
                                                          this,
                                                          {id:undefined}), cb);
                      };

                      <%= @model_name%>.prototype.destroy = function(cb) {
                        return <%= @model_name%>.remove({id: this._id}, cb);
                      };

                      return <%= @model_name%>;
});
*/

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
angularjs_scaffold-0.0.19 lib/generators/angularjs/scaffold/templates/plural_model_name.js
angularjs_scaffold-0.0.18 lib/generators/angularjs/scaffold/templates/plural_model_name.js
angularjs_scaffold-0.0.17 lib/generators/angularjs/scaffold/templates/plural_model_name.js
angularjs_scaffold-0.0.16 lib/generators/angularjs/scaffold/templates/plural_model_name.js