diff options
Diffstat (limited to 'src/ngResource/resource.js')
| -rw-r--r-- | src/ngResource/resource.js | 20 | 
1 files changed, 10 insertions, 10 deletions
| 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: - *   <pre> + *   ```js          var User = $resource('/user/:userId', {userId:'@id'});          var user = User.get({userId:123}, function() {            user.abc = true;            user.$save();          }); -     </pre> +     ```   *   *   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   * - * <pre> + * ```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); - * </pre> + * ```   *   * 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. -   <pre> +   ```js       var User = $resource('/user/:userId', {userId:'@id'});       var user = User.get({userId:123}, function() {         user.abc = true;         user.$save();       }); -   </pre> +   ```   *   * 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:   * -   <pre> +   ```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         });       }); -   </pre> +   ```   * # Creating a custom 'PUT' request   * In this example we create a custom method on our resource to make a PUT request - * <pre> + * ```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   *		}]); - * </pre> + * ```   */  angular.module('ngResource', ['ng']).    factory('$resource', ['$http', '$q', function($http, $q) { | 
