I want to alert an object value in AngularJs, how does one do that?
If I simply alert the object by alert(obj) then it shows the result as object object in alert box.
One way is
alert(JSON.stringify(obj)); .
angular.toJson(obj)If you do it for development purpose just to see object content, much better to use inspector in Chrome or Firebug in Firefox.
You can use $log service for that.
$log.info(obj);
This gives you advantage that you can now see object as tree and you can navigate. In alert some objects may be bigger that alert window.
alert(JSON.stringify(obj));