- $log
Logging with $log
examples/angular/logging.js
angular.module('DemoApp', []) .controller('DemoController', ['$log', function($log) { $log.debug("Some debug"); $log.info("Some info"); $log.log("Some log"); $log.warn("Some warning"); $log.error("Some error"); }]);
examples/angular/logging.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes"> <script src="angular.min.js"></script> <script src="logging.js"></script> </head> <body ng-app="DemoApp" ng-controller="DemoController"> <h1>Open the console!</h1> </body> </html>