Skip to content

Instantly share code, notes, and snippets.

@sheva29
Last active November 28, 2016 17:37
Show Gist options
  • Save sheva29/87b45244ad65170bf4638b6fc2fb742a to your computer and use it in GitHub Desktop.
Save sheva29/87b45244ad65170bf4638b6fc2fb742a to your computer and use it in GitHub Desktop.
/* when trying to console.log in Angular */
JSON.stringify($scope, function(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Circular reference found, discard key
return;
}
// Store value in our collection
cache.push(value);
}
return value;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment