AngularJS log JSON
Depending on your browser, the log
function can take multiple parameters. Chrome, for instance, supports this:
console.log("User = ", data);
When you do this, data
shows up in an object browser which you can show/collapse the hierarchy. It is extremely useful. Since I develop in Chrome, I vastly prefer this method (over JSON.stringify
) because it is less typing and the debugging experience is better.
If you are stuck debugging in a browser that doesn't support this syntax, then JSON.stringify
is probably your best bet.