|
144 | 144 | } |
145 | 145 | } |
146 | 146 |
|
147 | | - return $injector.get("$resource")(extractUrl(this, resourceObject.name), parameters, actions, options); |
| 147 | + return callBackend(extractUrl(this, resourceObject.name), parameters, actions, options); |
148 | 148 |
|
149 | 149 | } else if (resourceObject in this[config.links.key]) { |
150 | | - // get the url out of the resource name, remove the template parameters and return the Angular $resource method |
151 | | - return $injector.get("$resource")(extractUrl(this, resourceObject), paramDefaults, actions, options); |
| 150 | + // get the url out of the resource name and return the backend function |
| 151 | + return callBackend(extractUrl(this, resourceObject), paramDefaults, actions, options); |
152 | 152 | } |
153 | 153 |
|
154 | 154 | // return the available resources if the resource object is not set |
|
160 | 160 |
|
161 | 161 | }; |
162 | 162 |
|
| 163 | + /** |
| 164 | + * Returns the Angular $resource method which is configured with the given parameters. |
| 165 | + * |
| 166 | + * @param {string} url the url at which the resource is available |
| 167 | + * @param {object} paramDefaults optional $resource method parameter defaults |
| 168 | + * @param {object} actions optional $resource method actions |
| 169 | + * @param {object} options additional $resource method options |
| 170 | + * @returns {*} |
| 171 | + */ |
| 172 | + function callBackend(url, paramDefaults, actions, options) { |
| 173 | + return $injector.get("$resource")(url, paramDefaults, actions, options); |
| 174 | + } |
| 175 | + |
163 | 176 | /** |
164 | 177 | * Removes the template parameters of the given url. e.g. from this url |
165 | 178 | * 'http://localhost:8080/categories{?page,size,sort}' it will remove the curly braces |
|
0 commit comments