-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
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();
});
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels