If I extend the IResourceClass like so:
interface UserResource extends ng.resource.IResourceClass<UserResource> {}
Then when I try to access the headers when I query:
userResource.query({})
.$promise
.then(
(data, headers) => {
vm.headers = JSON.parse(headers("X-Pagination"))
vm.users = data;
}
)
it will give a compile error because the type definitions don't provide for the additional headers parameter. How do I resolve this?
The
headersfunction is exposed as the second argument of the optional success callback:For more information, see