Giter Site home page Giter Site logo

angular-hyper-resource's People

Contributors

johndgiese avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

angular-hyper-resource's Issues

Collection of embedded resources are not supported

In your list of examples, you specify that it's possible to do something like: books.query() but am not seeing the support if you return an actual collection of embedded entities:

The following test fails with Error: [$resource:badcfg] Error in resource configuration. Expected response to contain an array but got an object:

describe('collections:', function() {

    var Book;
    beforeEach(function() {
      Book = hResource('book', '/books/:id', {id: '@id'});
    });

    it('returns an array of entities embedded within a collection', function() {

      var response = {
          _embedded: {
              books: [
                  {
                      id: 1,
                      title: 'The BFG'
                  },
                  {
                      id: 2,
                      title: 'Matilda'
                  },
                  {
                      id: 3,
                      title: 'James and the Giant Peach'
                  },
              ]
          },
          _links: {
              self: {
                  href: '/books'
              }
          },
          count: 3,
          total: 10
      };
      $httpBackend.expectGET('/books').respond(200, response);

      var books = Book.query();

      $httpBackend.flush();
      expect(books).toBeArray();

    });

  });

How can I catch connection errors?

I'm currently working on the client-side code for my services without connection to them, and I have a line like

 new ResourceContext(HalResource).get(myRoot).$get()

which throws me an response.headers is not a function error. What's the correct way to handle these, a .then error handler?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.