AngularJS Tutorial - Log debug information








The following code shows how to Log debug information.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--from w  w w .  j  av a 2 s .c  o  m-->
<body>
  <div ng-app="app">
    <div ng-controller="MainCtrl">
        <h3>Make sure to open a javascript console so you can see the output.</h3>
    </div>
</div>
<script type='text/javascript'>
angular.module('app', []).controller('MainCtrl', ['$log', function($log){
    $log.debug('Hello Debug!');
}]);
</script>
</body>
</html>

The code above is rendered as follows: