code: function stringify(obj) {
              try {
                  return JSON.stringify(obj);
              } catch (e) {
                  var cache = [];
                  return JSON.stringify(obj, function (key, value) {
                      if (angular.isObject(value) && value !== null) {
                          if (cache.indexOf(value) !== -1) {
                              // Circular reference found, discard key
                              return;
                          }
                          // Store value in our collection
                          cache.push(value);
                      }
                      return value;
                  });
              }
          }
docs: Like JSON.stringify but that doesn't throw on circular references
  @param obj