Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
TypeError: s is undefined when using Angular.js $log service

I have been given an old Angular.js app to maintain and I have been tracking an elusive bug that made me use the $log service to display a lead on the console. I used $log since the very same IDE VSC tells me that using console.log is a bad practice. Well console.log works and when I use $log.log or anything derivative out of $log it just shows: "TypeError: s is undefined", not what I was trying to display. Now I am super curious, even though I can use console.log just fine I want to know what in the world is going on. My code:

import angular from "angular";

class StuffController{

    constructor($scope,$window,usuarioService,userSession,$log,$document){
        this.$scope=$scope;
        this.$log=$log;
        this.debug;

        this.debug = function(model){
            try{
                $log.log("this is a log for: " + model);
                $log.debug("this is a debug for: " + model);
            }catch(e){
                console.log("This is a console log for: " + model +" "+ e);
            }
        }
    }
}

stuffController.$inject=["$scope","$window","usuarioService","userSession"];

angular.module("webapp").controller("StuffController",StuffController);

When I use the debug function on any ng-change I get this on the console: This is a console log for: radio TypeError: s is undefined

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!