From d5ecf8963b32444797e24c8370acb1f091d844af Mon Sep 17 00:00:00 2001 From: "J. Roberto Vidal" Date: Tue, 7 Jun 2016 08:53:16 +0000 Subject: [PATCH] docs($resource): document Resource#toJSON Document the `toJSON` method of Resource instances as part of its public API. (#14637) --- src/ngResource/resource.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 77ef274be0c6..e912bc030fbf 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -265,6 +265,14 @@ function shallowClearAndCopy(src, dst) { * - `$cancelRequest`: If there is a cancellable, pending request related to the instance or * collection, calling this method will abort the request. * + * The Resource instances have these additional methods: + * + * - `toJSON`: It returns a simple object without any of the extra properties added as part of + * the Resource API. This object can be serialized through {@link angular.toJson} safely + * without attaching Angular-specific fields. Notice that `JSON.stringify` (and + * `angular.toJson`) automatically use this method when serializing a Resource instance + * (see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior)). + * * @example * * # Credit card resource