From f7d28cd377f06224247b950680517a187a7b6749 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Thu, 6 Feb 2014 14:02:18 +0000 Subject: docs(all): convert
/
snippets to GFM snippets --- src/ngResource/resource.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/ngResource') diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index a75aab61..2ee9cbbc 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -156,13 +156,13 @@ function shallowClearAndCopy(src, dst) { * instance of the resource class. The actions `save`, `remove` and `delete` are available on it * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create, * read, update, delete) on server-side data like this: - *
+ *   ```js
         var User = $resource('/user/:userId', {userId:'@id'});
         var user = User.get({userId:123}, function() {
           user.abc = true;
           user.$save();
         });
-     
+ ``` * * It is important to realize that invoking a $resource object method immediately returns an * empty reference (object or array depending on `isArray`). Once the data is returned from the @@ -206,7 +206,7 @@ function shallowClearAndCopy(src, dst) { * * # Credit card resource * - *
+ * ```js
      // Define CreditCard class
      var CreditCard = $resource('/user/:userId/card/:cardId',
       {userId:123, cardId:'@id'}, {
@@ -239,7 +239,7 @@ function shallowClearAndCopy(src, dst) {
      // POST: /user/123/card {number:'0123', name:'Mike Smith'}
      // server returns: {id:789, number:'0123', name: 'Mike Smith'};
      expect(newCard.id).toEqual(789);
- * 
+ * ``` * * The object returned from this function execution is a resource "class" which has "static" method * for each action in the definition. @@ -250,19 +250,19 @@ function shallowClearAndCopy(src, dst) { * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD * operations (create, read, update, delete) on server-side data. -
+   ```js
      var User = $resource('/user/:userId', {userId:'@id'});
      var user = User.get({userId:123}, function() {
        user.abc = true;
        user.$save();
      });
-   
+ ``` * * It's worth noting that the success callback for `get`, `query` and other methods gets passed * in the response that came from the server as well as $http header getter function, so one * could rewrite the above example and get access to http headers as: * -
+   ```js
      var User = $resource('/user/:userId', {userId:'@id'});
      User.get({userId:123}, function(u, getResponseHeaders){
        u.abc = true;
@@ -271,11 +271,11 @@ function shallowClearAndCopy(src, dst) {
          //putResponseHeaders => $http header getter
        });
      });
-   
+ ``` * # Creating a custom 'PUT' request * In this example we create a custom method on our resource to make a PUT request - *
+ * ```js
  *		var app = angular.module('app', ['ngResource', 'ngRoute']);
  *
  *		// Some APIs expect a PUT request in the format URL/object/ID
@@ -300,7 +300,7 @@ function shallowClearAndCopy(src, dst) {
  *
  *    // This will PUT /notes/ID with the note object in the request payload
  *		}]);
- * 
+ * ``` */ angular.module('ngResource', ['ng']). factory('$resource', ['$http', '$q', function($http, $q) { -- cgit v1.2.3