@@ -276,31 +276,32 @@ function shallowClearAndCopy(src, dst) {
276
276
* @example
277
277
* # Creating a custom 'PUT' request
278
278
* In this example we create a custom method on our resource to make a PUT request
279
- <pre>
280
- var app = angular.module('app', ['ngResource', 'ngRoute']);
281
-
282
- // Some APIs expect a PUT request in the format URL/object/ID
283
- // Here we are creating an 'update' method
284
- app.factory('Notes', ['$resource', function($resource) {
285
- return $resource('/notes/:id', null,
286
- {
287
- 'update': { method:'PUT' }
288
- });
289
- }]);
290
-
291
- // In our controller we get the ID from the URL using ngRoute and $routeParams
292
- // We pass in $routeParams and our Notes factory along with $scope
293
- app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes', function($scope, $routeParams, Notes) {
294
- // First get a note object from the factory
295
- var note = Notes.get({ id:$routeParams.id });
296
- $id = note.id;
297
-
298
- // Now call update passing in the ID first then the object you are updating
299
- Notes.update({ id:$id }, note);
300
-
301
- // This will PUT /notes/ID with the note object in the request payload
302
- }]);
303
- </pre>
279
+ * <pre>
280
+ * var app = angular.module('app', ['ngResource', 'ngRoute']);
281
+ *
282
+ * // Some APIs expect a PUT request in the format URL/object/ID
283
+ * // Here we are creating an 'update' method
284
+ * app.factory('Notes', ['$resource', function($resource) {
285
+ * return $resource('/notes/:id', null,
286
+ * {
287
+ * 'update': { method:'PUT' }
288
+ * });
289
+ * }]);
290
+ *
291
+ * // In our controller we get the ID from the URL using ngRoute and $routeParams
292
+ * // We pass in $routeParams and our Notes factory along with $scope
293
+ * app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',
294
+ function($scope, $routeParams, Notes) {
295
+ * // First get a note object from the factory
296
+ * var note = Notes.get({ id:$routeParams.id });
297
+ * $id = note.id;
298
+ *
299
+ * // Now call update passing in the ID first then the object you are updating
300
+ * Notes.update({ id:$id }, note);
301
+ *
302
+ * // This will PUT /notes/ID with the note object in the request payload
303
+ * }]);
304
+ * </pre>
304
305
*/
305
306
angular . module ( 'ngResource' , [ 'ng' ] ) .
306
307
factory ( '$resource' , [ '$http' , '$q' , function ( $http , $q ) {
0 commit comments