diff options
| author | Caitlin Potter | 2014-02-06 14:02:18 +0000 |
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-16 19:03:40 +0000 |
| commit | f7d28cd377f06224247b950680517a187a7b6749 (patch) | |
| tree | 20203b9f7bf60748bb752f325b1869415352a6f3 /src/ngResource | |
| parent | 2e641ac49f121a6e2cc70bd3879930b44a8a7710 (diff) | |
| download | angular.js-f7d28cd377f06224247b950680517a187a7b6749.tar.bz2 | |
docs(all): convert <pre>/</pre> snippets to GFM snippets
Diffstat (limited to 'src/ngResource')
| -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) { |
