FacultyCreative / ngActiveResource

Connects business objects and REST web services for Angular.js
255 stars 34 forks source link

Ability to override the resource name when calling `Model.api.set()` #55

Open marshall007 opened 10 years ago

marshall007 commented 10 years ago

There's currently no way to override the resource name without specifying each individual URL. This PR allows you to set the full path to the resource. Example:

angular.module('app', ['ActiveResource'])
  .factory('Post', ['ActiveResource', function(ActiveResource) {

    var Post = function (data) {
      // ...
    };

    Post.inherits(ActiveResource.Base);

    // this will use "posts" as the resource name
    Post.api.set('http://api.faculty.com/posts', true);

    return Post;

  });