src/angular-spring-data-rest-provider.js
function fetchFunction(url, key, data, fetchLinkNames, recursive, fetchMultiple) {
                if (config.fetchFunction == undefined) {
                    var promisesArray = [];

                    promisesArray.push($injector.get("$http").get(url)
                        .then(function (responseData) {

                            // wrap the response again with the adapter and return the promise
                            if (recursive) {
                                return processData(responseData.data, fetchLinkNames, true, fetchMultiple).then(function (processedData) {
                                    data[key] = processedData;
                                });
                            } else {
                                return processData(responseData.data).then(function (processedData) {
                                    data[key] = processedData;
                                });
                            }
                        }, function (error) {
                            if (error.status != 404) {
                                // just reject the error if its not a 404 as there are links which return a 404 which are not set
                                return $injector.get("$q").reject(error);
                            }
                        }));

                    // wait for all promises to be resolved and return a new promise
                    return $injector.get("$q").all(promisesArray);
                } else {
                    return config.fetchFunction(url, key, data, fetchLinkNames, recursive, fetchMultiple);
                }
            }
function fetchFunction(url, key, data, fetchLinkNames, recursive, fetchMultiple) {
                if (config.fetchFunction == undefined) {
                    var promisesArray = [];

                    promisesArray.push($injector.get("$http").get(url)
                        .then(function (responseData) {

                            // wrap the response again with the adapter and return the promise
                            if (recursive) {
                                return processData(responseData.data, fetchLinkNames, true, fetchMultiple).then(function (processedData) {
                                    data[key] = processedData;
                                });
                            } else {
                                return processData(responseData.data).then(function (processedData) {
                                    data[key] = processedData;
                                });
                            }
                        }, function (error) {
                            if (error.status != 404) {
                                // just reject the error if its not a 404 as there are links which return a 404 which are not set
                                return $injector.get("$q").reject(error);
                            }
                        }));

                    // wait for all promises to be resolved and return a new promise
                    return $injector.get("$q").all(promisesArray);
                } else {
                    return config.fetchFunction(url, key, data, fetchLinkNames, recursive, fetchMultiple);
                }
            }
function fetchFunction ( url , key , data , fetchLinkNames , recursive , fetchMultiple ) { if ( config . fetchFunction == undefined ) { var promisesArray = [ ] ; promisesArray . push ( $injector . get ( "$http" ) . get ( url ) . then ( function ( responseData ) { // wrap the response again with the adapter and return the promise if ( recursive ) { return processData ( responseData . data , fetchLinkNames , true , fetchMultiple ) . then ( function ( processedData ) { data [ key ] = processedData ; } ) ; } else { return processData ( responseData . data ) . then ( function ( processedData ) { data [ key ] = processedData ; } ) ; } } , function ( error ) { if ( error . status != 404 ) { // just reject the error if its not a 404 as there are links which return a 404 which are not set return $injector . get ( "$q" ) . reject ( error ) ; } } ) ) ; // wait for all promises to be resolved and return a new promise return $injector . get ( "$q" ) . all ( promisesArray ) ; } else { return config . fetchFunction ( url , key , data , fetchLinkNames , recursive , fetchMultiple ) ; } }
Fetches the given URL and adds the response to the given data object as a property
with the name of the given key.

@param {string} url the url at which the resource is available
@param {string} key the key inside the data object where to store the returned response
@param {object} data the data object reference in which the response is stored
@param {[string]|string} fetchLinkNames the fetch link names to allow to process the fetched response
@param {boolean} recursive true if the fetched response should be processed recursively with the
@param {boolean} fetchMultiple true if multiple same link names should be resolved. ATTENTION: this could lead to
an infinite loop when you have circular dependencies between the links.
adapter, false otherwise
Fetches the given URL and adds the response to the given data object as a property with the name of the given key .