我有点沮丧,因为我不知道AngularJS $ log服务的最新情况。在我的控制台中,尝试运行$ log.debug
时出现以下错误请帮忙
angular.min.js:62 TypeError: $log.debug is not a function
at StudentsController.js:16
at Object.$broadcast (angular.min.js:90)
at angular.min.js:82
at h (angular.min.js:78)
at h (angular.min.js:78)
at angular.min.js:78
at Object.$eval (angular.min.js:88)
at Object.$digest (angular.min.js:86)
at Object.$apply (angular.min.js:88)
at e (angular.min.js:95)
sampleApp.controller('StudentsController', function ($scope,$rootScope, $location,studentsService,$log) {
$rootScope.$on("$locationChangeStart", function () {
$log.debug("$locationChangeStart fired");
});
$rootScope.$on("$routeChangeStart", function () {
$log.debug("$routeChangeStart fired");
});
$rootScope.$on("$locationChangeSuccess", function () {
$log.debug("$locationChangeSuccess fired");
});
$rootScope.$on("$routeChangeSuccess", function () {
$log.debug("$routeChangeSuccess fired");
});
$scope.students = studentsService.getList();
$scope.msg = "Hello Ramakrishna"
});
//Define an angular module for our app
var sampleApp = angular.module('sampleApp', ["ngRoute"]);
sampleApp.config(['$routeProvider','$logProvider',
function ($routeProvider,$logProvider) {
$logProvider.debugEnabled(true);
$routeProvider.
when('/Home', {
templateUrl: 'templates/home.html',
controller: 'HomeController'
}).
when('/Courses', {
templateUrl: 'templates/courses.html',
controller: 'CoursesController'
}).
when('/Students', {
templateUrl: 'templates/students.html',
controller: 'StudentsController'
}).
when('/Students/:id', {
templateUrl: 'templates/studentsDetails.html',
controller: 'StudentsDetailsController'
}).
when("/studentsSearch/:name?", {
templateUrl: "templates/studentsSearch.html",
controller: "StudentsSearchController"
}).
otherwise({
redirectTo: '/Home'
});
}]);