Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda