AngularJS $log logging service


demo.html:

<!DOCTYPE html>  
<html lang="en">  
<head>  
    <meta charset="UTF-8">  
    <title>AngularJS</title>  
    <script src="angular.min.js"></script> <!-- Introduce AngularJS framework-->  
</head>  
<body ng-app="App">  
    <div ng-controller="DemoController">    
    </div>
    <script>  
        var App = angular.module('App',[]);  
  
        // $log log service  
        App.controller("DemoController",['$scope','$log',function($scope,$log) {  
            $log.info('Normal information'); // See the log in the console in the browser  
            $log.warn('Warning message');  
            $log.error('error message');  
            $log.log('print information'); // equivalent to console.log();  
            $log.debug('Debug information');  
  
        }]);  
          
    </script>  
</body>  
</html>  



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325948301&siteId=291194637