$log Service

AngularJs includes logging service $log, which logs the messages to the browser's console.

The $log service includes different methods to log the error, information, warning or debug information. It can be useful in debugging and auditing.

Example: $log
<!DOCTYPE html>
    <script src="~/Scripts/angular.js"></script>
<body ng-app="myApp" >
    <div ng-controller="myController">
        <p>Please check the browser console for the logging information.</p>
        var myApp = angular.module('myApp', []);

        myApp.controller("myController", function ($log) {
            $log.log('This is log.');
            $log.error('This is error.');
            $log.info('This is info.');
            $log.warn('This is warning.');
            $log.debug('This is debugging.');


In the above example, controller function includes $log parameter which will be supplied by AngularJS framework.

Want to check how much you know AngularJS 1?